Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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

Réponse acceptée

SvB
SvB le 28 Fév 2018
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.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by