Matlab 绘制三维常微分方程的散度
我是编码界的新手,最近开始从事编码工作 问题描述:我需要绘制一个由三维ODE描述的系统(liu)相对于系统在时间上的演化的发散度。代码是用MATLAB编写的。在代码中,我已经很好地描述了动力系统的必要细节,系统的散度是在直角坐标系下计算的,但我无法得到所需的输出。我在下面附上代码Matlab 绘制三维常微分方程的散度,matlab,math,ode,Matlab,Math,Ode,我是编码界的新手,最近开始从事编码工作 问题描述:我需要绘制一个由三维ODE描述的系统(liu)相对于系统在时间上的演化的发散度。代码是用MATLAB编写的。在代码中,我已经很好地描述了动力系统的必要细节,系统的散度是在直角坐标系下计算的,但我无法得到所需的输出。我在下面附上代码 %% % Aim: To obtain the plot of dissipativity (by calculating the divergence in rectangular coo
%%
% Aim: To obtain the plot of
dissipativity (by calculating the divergence in rectangular coordinate system)for the system liu
% Specify the system parameters
%Specify the system topology
%
function liu
t0 = 0; % Initial point
tn = 100; % Terminal point
Y0 = [2.2, 2.4, 38]; % Initial values
Y = [x, y, z]
a = 16;b = 100;c = 2.5;k=1;h=4; % system parameters
% Solve the equations for divergence.
divergence(dYdt, Y)
% generating plot of divergence v/s time
plot(t,divergence(dYdt, Y),'Color', [0.72,0.27,1.00])
%plot(t,Y(:,2),'Color', [0.72,0.27,1.00])
xlabel('t')
ylabel('y')
title('liu')
hold on
figure()
function dYdt = liu(~,X)
dxdt =a*(X(2)-X(1)); % SYSTEM TOPOLOGY
dydt = b*X(1)-k*x(1)*x(3); % SYSTEM TOPOLOGY
dzdt = -c*X(3)+ h*X(1)*X(1); % SYSTEM TOPOLOGY
dYdt = [dxdt; dydt; dzdt];
end
end
%
%%
我希望您首先使用ODE解算器计算ODE解,然后计算向量场沿该解的散度。我在你的代码中没有看到对ode45或ode15的调用或类似调用。谢谢,我会尝试一下。