not geting the plot and my loop is not working

1 vue (au cours des 30 derniers jours)
Sourav singh
Sourav singh le 12 Mar 2021
Commenté : Sourav singh le 13 Mar 2021
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');

Réponse acceptée

Mathieu NOE
Mathieu NOE le 12 Mar 2021
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');

Plus de réponses (1)

Alan Stevens
Alan Stevens le 12 Mar 2021
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 commentaires
Alan Stevens
Alan Stevens le 12 Mar 2021
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 le 13 Mar 2021
thank u sir

Connectez-vous pour commenter.

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by