The expression to the left of the equals sign is not a valid target for an assignment.

2 ビュー (過去 30 日間)
function[engtq_Nm,fuelrate_kgps]=calcengtq(xx,yy,zz,engpw_w,speed)
gearratio=[3.38,1.76,1.18,0.89,0.70,0.58];
engspeeds=speed./gearratio;
engtq_Nm=(engpw_w*30)./(pi.*engspeeds);
for i=1:1:6
fuelrategm/kwh(i)= interp2(xx,yy,zz,engspeeds(i),engtq_Nm(i));
end
fuelrate_kgps=fuelrategm/kwh.*engpw_w/36e8;
end
its giving me the error in line6. please help me with this

採用された回答

SvB
SvB 2018 年 2 月 28 日
If I'm right, line 6 refers to this line of code:
fuelrategm/kwh(i)= interp2(xx,yy,zz,engspeeds(i),engtq_Nm(i));
You're trying to assign the result of interp2(xx,yy,zz,engspeeds(i),engtq_Nm(i)) to a variable called fuelrategm/kwh. Matlab doesn't see this as a single variable, but interprets it as fuelrategm divided by kwh. To the left of the equal sign, you should just have a single variable.
Try renaming it to fuelrategm_kwh, and you should be fine.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by