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에서 Programming에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by