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

1 visualización (últimos 30 días)
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 );

Respuesta aceptada

J. Alex Lee
J. Alex Lee el 24 de En. de 2020
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 comentarios
J. Alex Lee
J. Alex Lee el 24 de En. de 2020
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by