not geting the plot and my loop is not working

1 visualización (últimos 30 días)
Sourav singh
Sourav singh el 12 de Mzo. de 2021
Comentada: Sourav singh el 13 de Mzo. de 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');

Respuesta aceptada

Mathieu NOE
Mathieu NOE el 12 de Mzo. de 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');

Más respuestas (1)

Alan Stevens
Alan Stevens el 12 de Mzo. de 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 comentarios
Alan Stevens
Alan Stevens el 12 de Mzo. de 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 el 13 de Mzo. de 2021
thank u sir

Iniciar sesión para comentar.

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by