getting error while solving PDE using ode45
古いコメントを表示
m=50;
delx=1/(m-1);
h_int=0.0005;
final_time=1;
N_samples=(final_time/h_int)+1;
t0=0;
tf=final_time;
p_mat=zeros(N_samples,m);
p_mat(1,:)=0;
for n=2:N_samples-1
[t(n),p_mat(n,:)]=ode45(@(t(n),p_mat(n,:)) GH(t(n),p_mat(n,:)), [t0 tf], p_mat(1,:));
end
plot(t, p_mat);
xlabel('time'),ylabel('pressure');
%%
function F_X= GH(t,p)
m=50;
delx=1/(m-1);
F_X = zeros(1,m);
% for i=1 and m
k=0.98*10^-12;
mu=0.001;
phi=0.4;
K1=k/((1-phi)*mu);
pg=2*10^6;
ph=30*10^6;
p(1)=pg;
p(m)=ph;
for i=2:m-1
F_X(i)=K1*((p(i+1)-2*p(i)+p(i-1))/(delx)^2);% K1 is k/(1-phi)*mu
end
end
2 件のコメント
Jan
2021 年 12 月 23 日
This is the code. Please add a copy of the complete error message.
MANISH KUMAR GUPTA
2021 年 12 月 23 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!