필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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 (최근 30일)
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
shunmugam hemalatha
shunmugam hemalatha 2020년 6월 18일
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;

답변 (1개)

Aayush Shah
Aayush Shah 2020년 6월 18일
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.
  댓글 수: 1
shunmugam hemalatha
shunmugam hemalatha 2020년 6월 19일
Thank you verymuch Sir for your answer.
Its so helpful to me to recover the mistakes.
Thank you.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by