Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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 );

Risposta accettata

J. Alex Lee
J. Alex Lee il 24 Gen 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 Commenti
J. Alex Lee
J. Alex Lee il 24 Gen 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

Accedi per commentare.

Più risposte (0)

Tag

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by