I can't solve this differential equation by ode45
beacause it has sig开发者_JAVA百科ularity.
xy"=3xcos(x)+sin(x) ; x(0)=0 , x'(0)=0
can you help me to write ode45
function?
You can use the sinc(x)
function, which is defined as sin(π*x)/(π*x)
, except at x=0
where its value is 1. So, you can rewrite your ODE as:
y'' = 3*cos(x) + sinc(x/π)
which ode45
shouldn't have any trouble solving.
精彩评论