Info

This question is closed. Reopen it to edit or answer.

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 view (last 30 days)
shunmugam hemalatha
shunmugam hemalatha on 18 Jun 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
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 Comments

Answers (1)

Aayush Shah
Aayush Shah on 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.

Community Treasure Hunt

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

Start Hunting!