Please, I am a begginer on Matlab and when I run my code the following warning appers:
Index exceeds matrix dimensions.
Error in otimizando (line 47) end
— How can I fix it? I already read that it is because of the size of the matrix, but I can't figure it out. The code is:
i = 1;a(i) = (1+((4*sin(phi_inicial)^2)/solidez*lift_coef*cos(phi_inicial)));b(i) = (1-3*a(i))/((4*a(i))-1);error(i) = 5; % guess
error1(i) = 5; % guess while (error(i)>=0.00001 || error1(i)>=0.00001) phi(i) = tan((1-a(i))/((1+b(i))*lambda_r)); F = (2/pi)*acos(exp(-((blade_number/2)*(1-(radius_analyzed/radius_total))/((radius_analyzed/radius_total)*sin(phi(i)))))); alfa(i) = phi(i)*180/pi - beta_inicial; lift(i) = -9e-9*alfa(i)^6 - 3e-7*alfa(i)^5 + 3e-6*alfa(i)^4 - 0.0001*alfa(i)^3 - 0.0003*alfa(i)^2 + 0.1194*alfa(i)+0.0034; % NACA 0012
drag(i) = 9e-9*alfa(i)^6 + 2e-8*alfa(i)^5 - 3e-6*alfa(i)^4 -6e-6*alfa(i)^3 + 0.0003*alfa(i)^2 + 0.0003*alfa(i) + 0.0045; % NACA 0012 trust_coef(i) = (solidez*((1-a(i))^2)*(lift(i)*cos(phi(i))+drag(i)*sin(phi(i))))/sin(phi(i))^2; if (trust_coef(i)>= 0.96) % Correção Glauerts
a(i+1) = (1/F)*(0.143+sqrt(0.0203-0.6427*(0.889-drag(i)))); else a(i+1) = (1+((4*F*sin(phi(i))^2)/(solidez*lift(i)*cos(phi(i)))))^-1; end b(i+1) = ((4*F*cos(phi(i))/solidez*lift(i))-1)^-1; error(i) = abs(abs(a(i+1))-abs(a(i))); error1(i) = abs(abs(b(i+1))-abs(b(i))); i = i + 1; end
Best Answer