Cant get for loop to run

1 次查看(过去 30 天)
Joe Bennet
Joe Bennet 2021-11-15
评论: Jon 2021-11-15
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

采纳的回答

Jon
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
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 CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by