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!