Hello, I'm running into an issue with my code where the left and the right side matrices' sizes do not match on the 2nd iteration of the for loop. Essentially, what happens is, in the first iteration, solving for the roots of p_bar would return 4 complex roots for p_bar_n. Extracting those 4 to omega_qus would give it a 4×1 size. In the 2nd iteration, p_bar_n returns with 5 complex roots. Therefore, it gives me this error. If I try to pre-allocate for omega_qus such as omega_qus = zeros(5), the first iteration would not work. Can somebody help me find a way to work around this?
%Quasi-unsteady aerodynamics (unsteady aero w/ no aerodynamic mass):clear flutter_det p_bar_n A_11 A_12 A_21 A_22 indsyms p_barfor r=1:length(U_bar)C = (0.55*p_bar + 0.15*U_bar(r))/(p_bar + 0.15*U_bar(r));A_11 = mu*p_bar^2 + 2*U_bar(r)*C*p_bar + mu*(omegah_omegaa)^2;A_12 = mu*x_alpha*p_bar^2 + (1 + 2*(1/2 - a)*C)*U_bar(r)*p_bar + ...2*C*U_bar(r)^2;A_21 = mu*x_alpha*p_bar^2 - 2*(1/2 + a)*U_bar(r)*C*p_bar;A_22 = mu*r_alpha_sq*p_bar^2 + ...((1/2 - a) - 2*(1/4 - a^2)*C)*U_bar(r)*p_bar + ...(mu*r_alpha_sq - 2*(1/2 + a)*C*U_bar(r)^2);flutter_det = det([A_11, A_12; A_21, A_22]);flutter_det = simplify(flutter_det);p_bar_n = eval(vpasolve(flutter_det));[omega_qus(:,r), ind] = sort(imag(p_bar_n));sigma_qus(:,r) = real(p_bar_n(ind));end