ODE solver: how to integrate a system with a vector of parameters?

1 次查看(过去 30 天)
Hello! I would like to ask how can I solve the system below for V varying from 1 to 1.2 with step 0.001? My aim is to plot bifurcation diagramm.
function [out] = chuaSmoothIris(~,in,alpha, beta, A, C, V)
x = in(1);
y = in(2);
z = in(3);
xdot = alpha*y - A*alpha*x^3 - C*alpha*x - V*alpha*x;
ydot = x - y + z;
zdot = -beta*y;
out = [xdot ydot zdot]';
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
t = [0 400];
y = [0.004 0 0];
alpha = 15.6;
beta = 28;
A = 0.002;
C = -1.3;
V = 1:0.001:1.2;
[t,y] = ode45(@(t, y) chuaSmoothIris(t, y, alpha', beta', A', C', V'), t, y );

采纳的回答

J. Alex Lee
J. Alex Lee 2020-1-24
Are you just looking for solving the ODE as many times as you have different values of V?
t = [0 400];
y = [0.004 0 0];
alpha = 15.6;
beta = 28;
A = 0.002;
C = -1.3;
V = 1:0.001:1.2;
for i = 1:length(V)
[t,y] = ode45(@(t, y) chuaSmoothIris(t, y, alpha', beta', A', C', V(i)), t, y );
end
  3 个评论
J. Alex Lee
J. Alex Lee 2020-1-24
Oops. It's because you are overwriting the variable y.
t = [0 400];
y0 = [0.004 0 0]; % give this a special name
alpha = 15.6;
beta = 28;
A = 0.002;
C = -1.3;
V = 1:0.001:1.2;
for i = 1:length(V)
[t,y] = ode45(@(t, y) chuaSmoothIris(t, y, alpha', beta', A', C', V(i)), t, y0 );
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by