how to output quantities involving time derivatives in pdepe

조회 수: 2 (최근 30일)
feynman feynman
feynman feynman 2024년 2월 13일
댓글: Torsten 2024년 2월 13일
pdeval only seems to output the solution and the spatial derivative of the solution via [~,dudx]=pdeval(m,x,sol(i,:,1),x). It seems it's no use putting dudt in as in [~,dudt]=pdeval(m,x,sol(i,:,1),x). How to output quantities involving time derivatives of the solution and the like?

채택된 답변

Torsten
Torsten 2024년 2월 13일
편집: Torsten 2024년 2월 13일
You don't have access to the spatial discretization of pdepe, thus no access to the exact time derivatives. But if you choose the output vector t fine enough, you can use the usual finite difference quotient in time:
dersol_t(i,:) = (sol(i+1,:,1)-sol(i,:,1))/(t(i+1)-t(i))
Maybe "deval" also works - I'm not sure. You can test it.
  댓글 수: 2
feynman feynman
feynman feynman 2024년 2월 13일
편집: feynman feynman 2024년 2월 13일
thanks! dersol_t(i,:) = (sol(i+1,:,1)-sol(i,:,1))/(t(i+1)-t(i)) is what I thought of but I wish there were sth provided by matlab that is more accurate.
I have no idea how to make deval work for pdepe solutions since deval(~,sol,~) requires sol to be an ode solution struct out of ode23,45 etc. Maybe I can forge an ode struct by hand?
Torsten
Torsten 2024년 2월 13일
You can attain higher order accuracy if you use more accurate difference formulae than the simple Euler forward I suggested. I think "deval" can't do better - at least if the ode integrator with which the results were achieved is not known to "deval" by the sol structure.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by