Variable Set by Non-scalar Properator??

2 次查看(过去 30 天)
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?

回答(1 个)

Star Strider
Star Strider 2014-7-30
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.

类别

Help CenterFile Exchange 中查找有关 Sparse Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by