sytibm 发表于 2012-2-22 11:31:59

ode求解二阶微分方程组(矩阵形式)

假设x的二阶导数为a,方程如下:a=5-6x,其中x为含有几个坐标的n*1的矩阵,这么用ode求解?我求解时老出现错误信息如下:??? Inputs to odearguments must be floats, namely single or double.谢谢!

kb24lal 发表于 2012-2-22 13:00:26

数学模型:
x"+6x-5=0
%****************create a function**********
function dy=myfun(t,y)
n=3;   % supposed
dy=;
%************save*************
%************solve the function 'myfun'************
clc
clear
n=3;
tspan=;
y0=zeros(1,2*n);
=ode45(@myfun,tspan,y0);
subplot(3,2,1),plot(t,y(:,1));
subplot(3,2,2),plot(t,y(:,2));
subplot(3,2,3),plot(t,y(:,3));
subplot(3,2,4),plot(t,y(:,4));
subplot(3,2,5),plot(t,y(:,5));
subplot(3,2,6),plot(t,y(:,6));
%************END**************
不知道这个是不是你要的


kb24lal 发表于 2012-2-22 13:01:21

数学模型:
x"+6x-5=0
%****************create a function**********
function dy=myfun(t,y)
n=3;   % supposed
dy=;
%************save*************
%************solve the function 'myfun'************
clc
clear
n=3;
tspan=;
y0=zeros(1,2*n);
=ode45(@myfun,tspan,y0);
subplot(3,2,1),plot(t,y(:,1));
subplot(3,2,2),plot(t,y(:,2));
subplot(3,2,3),plot(t,y(:,3));
subplot(3,2,4),plot(t,y(:,4));
subplot(3,2,5),plot(t,y(:,5));
subplot(3,2,6),plot(t,y(:,6));
%************END**************
不知道这个是不是你要的


sytibm 发表于 2012-2-22 15:17:04

kb24lal 发表于 2012-2-22 13:00 static/image/common/back.gif
数学模型:
x"+6x-5=0
%****************create a function**********


谢谢你啊,我就想知道function怎么弄的,我一会按照你的思路再编程试试。谢谢

jiaoxiaolei2010 发表于 2012-4-19 21:23:37

kb24lal 发表于 2012-2-22 13:01 static/image/common/back.gif
数学模型:
x"+6x-5=0
%****************create a function**********


如果是多元常微分方程组怎么处理啊,有没有通式呢?
页: [1]
查看完整版本: ode求解二阶微分方程组(矩阵形式)