SimWe仿真论坛---(论坛实行邀请码注册)'s Archiver

prudencewang 发表于 2005-7-3 20:06

用ode45解微分方程的问题

我想问一下具体怎么使用matlab命令ode45解微分方程?

lyrock 发表于 2005-7-4 01:25

Re:用ode45解微分方程的问题

for detail, you can refer the doc I upload

ODE45 is a built in function in MATLAB. This function consists of an automatic step-size Runge-Kutta-Fehlberg integration method which is a combination of a fourth- and fifth-order method. In order to use this function to solve a differential equation, the equation must first be written as a system of first order equations(like equation (1)&(2)). These equations need to be put in a function file, which ODE45 can access. For this example, the function file is call nonlin.m and it contains the following command:

function xdot=nonlin(t,x)
xdot=[0.5*cos(0.5*t)-x(2)-0.5*x(2)^3-0.4*x(1); x(1)]

The function ODE45 also needs to be given an initial time t0, a final time tf, and a column vector of initial conditions x0, as shown in the following main program:

t0=0;
tf=40;
x0=[0,0.05]';
[t,x]=ode45('nonlin',t0,tf,x0);
x1=x(:,1);
x2=x(:,2);
plot(t,x1)  % this is the velocity curve
title('Time Vs Velocity')
figure
plot(t,x2)  % this is the acceleration curve
title('Time Vs Acceleration')

lyrock 发表于 2005-7-4 01:27

Re:用ode45解微分方程的问题

An Example of ODE45

prudencewang 发表于 2005-7-4 14:39

Re:用ode45解微分方程的问题

谢谢各位
:):)

jerry_cao 发表于 2005-7-6 09:30

Re:用ode45解微分方程的问题

Search "use matlab to solve differential equations" by using google, you can get enough materials.

remington_kw 发表于 2005-7-6 12:43

Re:用ode45解微分方程的问题

请问,在MATLAB里如何解决三维的有限元问题呢?

lyrock 发表于 2005-7-8 23:17

Re:用ode45解微分方程的问题

I developed a 2D truss FEM GUI program in MATLAB.

Although it isn't 3D, their principles are the same.

You can also find some 3D FEM programs in the website of Mathworks(Files exchange)

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.