필터 지우기
필터 지우기

not geting the plot and my loop is not working

조회 수: 2 (최근 30일)
Sourav singh
Sourav singh 2021년 3월 12일
댓글: Sourav singh 2021년 3월 13일
sigma=0.047193;
V_tip=180;
W=180;
Cd_avg=0.01;
R=2.235;
Rv=80.529; %rotational velocity
A=pi*R.^2;
rho=1.225;
for Ct=0.004:0.0001:0.005
Vs=-(sqrt(Ct./2)+((sigma*Cd_avg)./(8*Ct))).*(Rv*R); %descent speed
Cd_eq=((2*W)./(rho.*A.*(Vs).^2)); % equivalent drag coefficient of the rotor in steady descent
end
hold on
plot(Ct,Cd_eq,'r');

채택된 답변

Mathieu NOE
Mathieu NOE 2021년 3월 12일
hello
consider indexing your variables
sigma=0.047193;
V_tip=180;
W=180;
Cd_avg=0.01;
R=2.235;
Rv=80.529; %rotational velocity
A=pi*R.^2;
rho=1.225;
Ct=0.004:0.0001:0.005;
Cd_eq = zeros(1,length(Ct));
for ci = 1:length(Ct)
Cti = Ct(ci);
Vs=-(sqrt(Cti./2)+((sigma*Cd_avg)./(8*Cti))).*(Rv*R); %descent speed
Cd_eq(1,ci)=((2*W)./(rho.*A.*(Vs).^2)); % equivalent drag coefficient of the rotor in steady descent
end
plot(Ct,Cd_eq,'r');

추가 답변 (1개)

Alan Stevens
Alan Stevens 2021년 3월 12일
Needs to be as follows:
sigma=0.047193;
V_tip=180;
W=180;
Cd_avg=0.01;
R=2.235;
Rv=80.529; %rotational velocity
A=pi*R.^2;
rho=1.225;
Ct = 0.004:0.0001:0.005;
for i = 1:numel(Ct)
Vs=-(sqrt(Ct(i)./2)+((sigma*Cd_avg)./(8*Ct(i)))).*(Rv*R); %descent speed
Cd_eq(i)=((2*W)./(rho.*A.*(Vs).^2)); % equivalent drag coefficient of the rotor in steady descent
end
hold on
plot(Ct,Cd_eq,'r');
  댓글 수: 3
Alan Stevens
Alan Stevens 2021년 3월 12일
i is a commonly used index counter, but it is arbitrary and you can use whatever you like.
You can also have Vs(i) if you wish, then all values of Vs are available at the end of the loop. However, your original code only had Cd_eq being plotted, so that was the only one I put the i into.
Sourav singh
Sourav singh 2021년 3월 13일
thank u sir

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Pulse and Transition Metrics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by