Variable Set by Non-scalar Properator??

조회 수: 1 (최근 30일)
Kevin
Kevin 2014년 7월 30일
답변: Star Strider 2014년 7월 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에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by