Variable Set by Non-scalar Properator??

1 visualizzazione (ultimi 30 giorni)
Kevin
Kevin il 30 Lug 2014
Risposto: Star Strider il 30 Lug 2014
Hi,
In my Matlab code I am using the following equations:
if axial_induction<0.4;
C_T=(sigma_local .* ((1-axial_induction).^2) .* ((Cl.*cos(relative_wind))+(Cd.*sin(relative_wind)))) ./ ((sin(relative_wind)).^2);
else
C_T=(8/9).*(4.*F-(40/9)).*axial_induction+((50/9)-4.*F).*(axial_induction.^2);
end
axial_induction is a 9x1 array of values. However I am getting an error stating that the variable 'axial_induction' might be set by a non-scalar operator. Can anybody please help me?

Risposte (1)

Star Strider
Star Strider il 30 Lug 2014
I’m not familiar with that error (never encountered it as you describe) but this might be what you want:
for k1 = 1:length(axial_induction)
if axial_induction(k1)<0.4;
C_T(k1)=(sigma_local .* ((1-axial_induction(k1)).^2) .* ((Cl.*cos(relative_wind))+(Cd.*sin(relative_wind)))) ./ ((sin(relative_wind)).^2);
else
C_T(k1)=(8/9).*(4.*F-(40/9)).*axial_induction(k1)+((50/9)-4.*F).*(axial_induction(k1).^2);
end
end
A guess here, but that is how I would do it.

Categorie

Scopri di più su Sparse Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by