0

我有一个可以解决 dy/dt=t/y 和 y(0)=1 的 matlab 代码,对于任何给定的问题,我如何推广它来解决 dy/dt=f(t,y), y(o)=y_0 f(t,y)?

4

1 回答 1

0

You will have to read a few books on numerical methods for ODEs. I think you cannot make general code even for this relatively simple case. You have here y' + F(y,t) = 0 which is just a first-order ODE. Without knowing the structure of F we can't talk about a single way to find a solution. But if F is at least Lipschitz continuous you may try any of the Euler methods. They are not that difficult.

I can imagine that your code is already using one of Euler methods, so if you don't care about F being some "bad" function, you can just modify your code to use F and y(0)=y_0 instead of y/t and (0,1).

于 2011-03-23T04:33:53.897 回答