matlab出错:The expression to the left of the equals sign is no
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/16 22:13:27
matlab出错:The expression to the left of the equals sign is not a valid target for an assignment
? P(i+1)=P(i)*(V(i)-S*v(i)*dt(i))/(V(i)-sigma(i)*dt(i));
|
Error: The expression to the left of the equals sign is not a valid target for an assignment.
程序如下
P=1:100;
P(1)=10100;
m=70;
g=9.8;
h=0.762;
N=100;
dz=h/N;
v0=4.27;
S=0.581;
dt=1:100;
dt(1)=h/(v0*N);
V=1:100;
for i=1:100
V(i)=S*(101-i);
end
z=1:100;
for ii=1:100
z(ii)=h/N*(ii-1);
end
e=2.71828;
sigma=1:100;
for iii=1:100
sigma(iii)=2*S*e.^(4*z(iii)/h);
end
v=1:100;
v(1)=v0;
for j=1:99
{
P(i+1)=P(i)*(V(i)-sigma(i)*dt(i))/(V(i)-S*v(i)*dt(i));
v(i+1)=sqrt((m*g*dz-P(i+1)*S*dz+0.5*m*v(i)*v(i))/(0.5*m));
dt(i+1)=h/(v(i+1)*N);
}
end
? P(i+1)=P(i)*(V(i)-S*v(i)*dt(i))/(V(i)-sigma(i)*dt(i));
|
Error: The expression to the left of the equals sign is not a valid target for an assignment.
程序如下
P=1:100;
P(1)=10100;
m=70;
g=9.8;
h=0.762;
N=100;
dz=h/N;
v0=4.27;
S=0.581;
dt=1:100;
dt(1)=h/(v0*N);
V=1:100;
for i=1:100
V(i)=S*(101-i);
end
z=1:100;
for ii=1:100
z(ii)=h/N*(ii-1);
end
e=2.71828;
sigma=1:100;
for iii=1:100
sigma(iii)=2*S*e.^(4*z(iii)/h);
end
v=1:100;
v(1)=v0;
for j=1:99
{
P(i+1)=P(i)*(V(i)-sigma(i)*dt(i))/(V(i)-S*v(i)*dt(i));
v(i+1)=sqrt((m*g*dz-P(i+1)*S*dz+0.5*m*v(i)*v(i))/(0.5*m));
dt(i+1)=h/(v(i+1)*N);
}
end
你的循环变量是j啊...
把最后一个for循环里的i全改成j就好.
再多说句,matlab里面最好不要用i和j做循环变量,很容易和复数运算混淆.最好用m,n,k,l之类的.
再问: 我把i改成j,还是相同的错误提示 for j=1:99 { P(j+1)=P(j)*(V(j)-sigma(j)*dt(j))/(V(j)-S*v(j)*dt(j)); v(j+1)=sqrt((m*g*dz-P(j+1)*S*dz+0.5*m*v(j)*v(j))/(0.5*m)); dt(j+1)=h/(v(j+1)*N); } end ??? P(j+1)=P(j)*(V(j)-sigma(j)*dt(j))/(V(j)-S*v(j)*dt(j)); | Error: The expression to the left of the equals sign is not a valid target for an assignment.
再答: 我懂了!!这个又不是C...for后面不用大括号的.. for j=1:99 P(j+1)=P(j)*(V(j)-sigma(j)*dt(j))/(V(j)-S*v(j)*dt(j)); v(j+1)=sqrt((m*g*dz-P(j+1)*S*dz+0.5*m*v(j)*v(j))/(0.5*m)); dt(j+1)=h/(v(j+1)*N); end
把最后一个for循环里的i全改成j就好.
再多说句,matlab里面最好不要用i和j做循环变量,很容易和复数运算混淆.最好用m,n,k,l之类的.
再问: 我把i改成j,还是相同的错误提示 for j=1:99 { P(j+1)=P(j)*(V(j)-sigma(j)*dt(j))/(V(j)-S*v(j)*dt(j)); v(j+1)=sqrt((m*g*dz-P(j+1)*S*dz+0.5*m*v(j)*v(j))/(0.5*m)); dt(j+1)=h/(v(j+1)*N); } end ??? P(j+1)=P(j)*(V(j)-sigma(j)*dt(j))/(V(j)-S*v(j)*dt(j)); | Error: The expression to the left of the equals sign is not a valid target for an assignment.
再答: 我懂了!!这个又不是C...for后面不用大括号的.. for j=1:99 P(j+1)=P(j)*(V(j)-sigma(j)*dt(j))/(V(j)-S*v(j)*dt(j)); v(j+1)=sqrt((m*g*dz-P(j+1)*S*dz+0.5*m*v(j)*v(j))/(0.5*m)); dt(j+1)=h/(v(j+1)*N); end
matlab出错:The expression to the left of the equals sign is no
MATLAb 提示The expression to the left of the equals sign is no
matlab提示 The expression to the left of the equals sign is no
MATLAB调试出现The expression to the left of the equals sign is n
【matlab】Error: The expression to the left of the equals sign
MATLAB编程出现问题,The expression to the left of the equals sign i
matlab Error:The expression to the left of the equals sign i
The expression to the left of the equals sign is not a valid
英语翻译这是MATLAB报错的内容:The expression to the left of the equals s
关于matlab,调试的时候出现Error:The expression to the left of the equa
There is no outward sign of the disorder
The expression of love is only words,