Cant get for loop to run
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Jon
2021-11-15
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 个评论
Jon
2021-11-15
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) = ...
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!