![]() |
如何用MATLAB解微分方程
我有个问题。那是 :
y"^2 + 2*y'+ 3*y = sin(x), y'(0)=0, y(0)=1 我想用MATLAB解决此问题,但不能。 你能帮助我吗 ? [B]回答:[/B] 首先,您必须减少订单。令z = y'=> z'= y“ 您的ODE然后变为 z' = sqrt(-2*z - 3*y + sin(x)), with z(0) = 0 y' = z, with y(0) = 1 您现在可以在MATLAB中编写一个函数来表示此ODE :(其中M = [zy]') function dMdx = odefunc(x,M) z = M(1); y = M(2); dMdx(1) = sqrt(-2*z - 3*y + sin(x)); dMdx(2) = z; end 然后可以按以下方式调用此函数: M0 = [ 0 1 ]; % Initial values of ODE tfinal = 12; % Final integration time [x,M] = ode45(@odefunc,[0 tfinal],M0) % Integration using the RK-45 algorithm [url=https://stackoverflow.com/questions/3326857]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 01:02。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.