i need to draw bifurcation and lyapunav for duffing oscillator can anyone help to solve

1 view (last 30 days)
function duffing_oscillator clear all
amp=0.40; % control parameter
alpha=0.5;
beta=-1.0;
gamma=1;
w=1;
tspan = 0:0.1:800; %time step and initial condition
x10 = 0.5021; x20 = 0.17606;
y0 = [x10; x20];
[~,y] = ode45(@(t,x) f(t,x,alpha,beta,gamma,amp,w),tspan,y0);
x1=y(:,1); x2=y(:,2);
plot(x1,x2); %plot the variable x and y
xlabel ('x1');
ylabel ('x2');
title('phase portrait of duffing oscillator');
function dy = f(t,y,alpha,beta,gamma,amp,w)
x1 = y(1); x2 = y(2);
dx1=x2;
dx2=-alpha*x2-beta*x1-gamma*x1^3+amp*sin(w*t);
dy = [dx1; dx2];

Answers (0)

Categories

Find more on Nonlinear Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!