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

1 次查看(过去 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 CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by