Cant get for loop to run

1 visualización (últimos 30 días)
Joe Bennet
Joe Bennet el 15 de Nov. de 2021
Comentada: Jon el 15 de Nov. de 2021
Trying to calculate a value as one of the parameters it depends on increases
clc, clear, close all
f= 0.13;%Flap Length as Percenatge of Total Chord
beta= 25;%Flap Angle
c= 100;%Chord Length
tan_alpha= (f*sind(beta))/(c-f+f*cosd(beta));
alpha= atand(tan_alpha); %Effective Angle of Attack
%Calculating Effective Angle of Attack for Increasing Flap Angle
F=(0:0.1:100);
alpha= zeros(length(F)-1,1);
for n=1:1:length(F)-1
f(n)=f(n)/c
alpha(n)= ((f(n)*sind(beta))/(c-f(n)+f(n)*cosd(beta)));
end
However the for loop isnt working? any help is appreciated, what i want is a arrray of values for alpha as the value of f increases from 0 to 100

Respuesta aceptada

Jon
Jon el 15 de Nov. de 2021
It looks like you define f to be a scalar at the top of your script. So it doesn't make sense to iterate through values of f(n) in the loop
  1 comentario
Jon
Jon el 15 de Nov. de 2021
Maybe you are getting confused between your lower case f and your upper case F? Also it looks strange that you define alpha as a scalar and then later start assigning values to an array of alpha, i.e. alpha(n) = ...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by