Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Unable to perform assignment because the left and right sides have a different number of elements.

1 回表示 (過去 30 日間)
Raul Chavez
Raul Chavez 2019 年 4 月 25 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
hello,
can anyone tell me why I'm getting this error message in line 16. I'm not very good with MATLAB but I need to solve this O.D.E using Eulers numerical method. Thanks.
clear all;
clc;
k=-0.1865;
te0=0;
Te0=100;
teF=50;
h=0.01;
n=(teF-te0)/h;
te_=[te0:h:teF];
Te_= zeros(n+1,1);
Te_(1)=Te0;
for i=1:n
fi=k*(Te_(i)-30);
Te_(i+1)=Te_+h*fi;
end

回答 (1 件)

James Tursa
James Tursa 2019 年 4 月 25 日
I would assume this
Te_(i+1)=Te_+h*fi;
was meant to be this
Te_(i+1) = Te_(i) + h * fi;

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by