フィルターのクリア

Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='. in column 20

1 回表示 (過去 30 日間)
Advait Sinha
Advait Sinha 2019 年 6 月 25 日
コメント済み: TADA 2019 年 6 月 25 日
close all;
dt = 0.464;%time step
u1=1;
u2=1;
k=0.12;
m=2.21;%initial parameters
v=1;
a=1.4;
tend=100;
t=0;
i=1
while t < tend-2*dt
vh=v(i)-dt*k*(u1(i)-u2(i))/ (2*m);
u1(i+1)-u2(1+1) = u1(i)-u2(i)+ dt*vh;
a(i+1)= -k*u1(i+1)-u2(i)/2;
v(i+1)= vh + dt*a(i+1)/2;
i = i+1;
t = t + dt
end
plot(linspace(0,tend,tend/dt),u1-u2);
  1 件のコメント
TADA
TADA 2019 年 6 月 25 日
What exactly are you trying to do here
u1(i+1)-u2(1+1) = u1(i)-u2(i)+ dt*vh;
You can't do an assignment into an arithmetic calculation

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by