快捷搜索:  汽车  科技

matlab解微分方程组的步骤(解偏微分方程组的数值解法)

matlab解微分方程组的步骤(解偏微分方程组的数值解法)plot(x(: 2) x(: 3))plot(x(: 1) x(: 3))opts=odeset('RelTol' 1e-5 'AbsTol' 1e-5);[t x]=ode45(@chaos tspan cond opts)plot(x(: 1) x(: 2))

很多小伙伴问MATLAB 解偏微分方程组的数值解法编程问题,这里提供2种常用的MATLAB数值解法及源代码(ODE45和ODE15s)。

洛伦兹混沌

clc;clear;close all

tspan=[0 100];

cond=[1.3 4 2];

opts=odeset('RelTol' 1e-5 'AbsTol' 1e-5);

[t x]=ode45(@chaos tspan cond opts)

plot(x(: 1) x(: 2))

plot(x(: 1) x(: 3))

plot(x(: 2) x(: 3))

plot3(x(: 1) x(: 2) x(: 3))

opts=odeset('RelTol' 1e-5 'AbsTol' 1e-5);

[t x]=ode15s(@chaos tspan cond opts)

plot(x(: 1) x(: 2))

plot(x(: 1) x(: 3))

plot(x(: 2) x(: 3))

plot3(x(: 1) x(: 2) x(: 3))

function dx=chaos(t x)

ru=10;

b=8/3;

r=28;

dx=[ru*(x(2)-x(1));r*x(1)-x(2)-x(1)*x(3);x(1)*x(2)-b*x(3)];

end

得到的图形为:

matlab解微分方程组的步骤(解偏微分方程组的数值解法)(1)

matlab解微分方程组的步骤(解偏微分方程组的数值解法)(2)

matlab解微分方程组的步骤(解偏微分方程组的数值解法)(3)

matlab解微分方程组的步骤(解偏微分方程组的数值解法)(4)

猜您喜欢: