ode15s
古いコメントを表示
Solving a partial differential equation with ode15s,we know that this ode solver integrates the ode over time direvatives.I need to find the values of these time direvatives,do you have any special command? for example: for i=1:n dudt=uxx(i) end
how can I find these dudt at each time and x(i)? thanks alot
採用された回答
その他の回答 (2 件)
Bård Skaflestad
2012 年 1 月 30 日
0 投票
If you're going to solve a PDE by the method of lines (i.e., converting it into a system of ODEs), then you will need to provide a spatial discretisation of the PDE along with suitable initial conditions whence ode15s (or others) will likely assist you in the numerical solution.
Please review your favourite text book on discretisation methods.
4 件のコメント
ahmad
2012 年 1 月 30 日
Bård Skaflestad
2012 年 1 月 30 日
I'd be *very* surprised if the solver stores all function values throughout the computation. That is an extraordinary amount of data, especially if the spatial resolution is high or if you're solving a multi-dimensional PDE.
However, I'm thoroughly confused about what you're asking. Isn't |dudt| exactly the output of your |odefun|? Can you not calculate these values yourself by simply calling your |odefun| directly at a point (t,u)? This process may even be directed by the |OutputFcn| facility detailed in the |optimset| documentation.
Bård Skaflestad
2012 年 1 月 30 日
Sorry, I meant |odeset|, not |optimset|.
ahmad
2012 年 1 月 30 日
Andrew Newell
2012 年 1 月 30 日
EDIT: Here is a modified version of the example at the link provided:
sol = ode45(@vdp1,[0 20],[2 0]);
t = linspace(0,20,100);
[y,dy] = deval(sol,t,1);
plot(t,dy);
3 件のコメント
Bård Skaflestad
2012 年 1 月 30 日
Possibly, but I don't think that's what the OP actually wants. If I understand correctly, he wants to calculate the (temporal) derivative of the solution which |deval| does not do -- or at least not return to the caller. I think he should just call his original |odefun| from an |OutputFcn| and then do something sensible with the result.
I could be mistaken, though, and I'd be happy to stand corrected.
Andrew Newell
2012 年 1 月 30 日
I think it is the time derivative (as in the example I added), but for a polynomial fitting the solution. I provide a more direct solution in a separate answer.
Bård Skaflestad
2012 年 1 月 30 日
Indeed it is. The second output of |deval| is the derivative (wrt the independent variable) of the continuous output polynomial fitted to the numerical scheme of the particular solver (ODE45 in the above example).
Yet another detail I'd missed while skimming the documentation of |deval|.
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!