フィルターのクリア

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 日間)
shunmugam hemalatha
shunmugam hemalatha 2020 年 6 月 18 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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