Cant get for loop to run

1 Ansicht (letzte 30 Tage)
Joe Bennet
Joe Bennet am 15 Nov. 2021
Kommentiert: Jon am 15 Nov. 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

Akzeptierte Antwort

Jon
Jon am 15 Nov. 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 Kommentar
Jon
Jon am 15 Nov. 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) = ...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by