フィルターのクリア

I modified the code more than once and every time there was an error, can someone tell me where the problem is and how to solve it?

3 ビュー (過去 30 日間)
function out = Crank_Niclson( D, u)
beta=0.5;
% where D = alpha * dt / dx^2
A=zeros(length(u),length(u));
B=u;
B(2:end-1)=B(2:end-1)*(1-2*(1-beta)*D);
for i=1:length(u)
%[I,J]=xxx(size,i);
I=i;
if i==1 ||i==length(u)
A(i,i)=1;
else
for j=1:length(u)
%[I1,J1]=xxx(size,j);
I1=j;
A(i,i)=1+2*beta*D;
if abs(I1-I) >1
A(i,j)=0;
elseif I1-I==+1
B(i)=B(i)+(1-beta)*D*u(j);
A(i,j)=-beta*D;
elseif I1-I==-1
B(i)=B(i)+(1-beta)*D*u(j);
A(i,j)=-beta*D;
end
end
end
end
out = (A\B')';
end
  1 件のコメント
Mathieu NOE
Mathieu NOE 2022 年 5 月 11 日
hello
you have to post a fully working code and not only the function so we can better help you

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by