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
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!