Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

While running the code, I am getting error expression as, 'The expression to the left of the equals sign is not a valid target for an assignment'.

1 Ansicht (letzte 30 Tage)
clc
clear all
syms q TOT
D=1000;
P=3200;
S=400;
A0=25;
Cv=20;
Cb=25;
Rc=3;
Cs=30;
MUv=0.2;
MUb=0.2;
sigma=7;
k=2.33;
L0=8;
Gamma=0.05;
Delta=5;
is=0.02;
iv=0.02;
ic=0.06;
M=0.1;
Z(L)=0;
n=1;
L=8;
Alpha=20;
Beta=0.6250;
q=0;
for i=1:10
q=sqrt(((2*D)*((Alpha+Beta*ln(L))+(s/n)+Z(L)+((D*M^2)/2)*(Cb*ic-Cs*is)))/((MUb*Cb)+(MUv*Cv)*(n*(1-(D/P))-1+((2*D)/P))))
TOT=(D/q)*((Alpha+Beta*ln(L))+(s/n)+Z(L)+((D*M^2)/2)*(Cb*ic-Cs*is))+(q/2)*((MUb*Cb)+(MUv*Cv)*(n*(1-(D/P)-1+((2*D)/P)+(Cb*ic))+(MUb*Cb*k*sigma*sqrt(L))=(Rc*Gamma*D)+(Cb*D*M*(im-ic))
end
The answer is q=332, TOT=3240.
  3 Kommentare
shunmugam hemalatha
shunmugam hemalatha am 18 Jun. 2020
I have corrected the mistake that you have pointed. But i don't know how to enter the data Z(L). Still the error shows that (Undefined function or variable 'L')
Z(L)=0;

Antworten (1)

Aayush Shah
Aayush Shah am 18 Jun. 2020
Hi Shunmugam,
My understanding of your question is that you are getting an error while assigning a value after doing the computations. The reason for it is that you’re using two assignment (=) operators in a single line. The ‘=’ sign at col 156(i.e., before ‘Rc’) is wrong. Another error you might encounter after changing the above code is from this line:
Z(L)=0;
n=1;
L=8;
You will get an error because you’re trying to use the value of ‘L’ before assigning it any value. Interchange the lines and your issue would be solved.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by