Documente Academic
Documente Profesional
Documente Cultură
Fixed points:
dx
x2 a
dt
It is an autonomous differential equation
dx
x2 a 0
dt
x2 a
x a
in case a 0
fixed po int s are real
in case a 0
x0
2 solved separately for Matlab manipulation
Directional field 11
Bifurcation diagram 13
clc
clear all
clf
close all
global a
a_var = [-0.5 0.6 0];
x0=0.001;
tspan = [0 10];
for counter=1:1:3
a = a_var(counter);
[t X] = ode45(@DE_model,tspan,x0);
Xdot = DE_model(t,X)
figure
% subplot(2,1,1)
plot(X,Xdot)
xlabel('Displacement, x [m]')
ylabel('Velocity, xdot [m/s]')
title([' Initial conditions : x(0) = ',num2str(x0),' a = ',num2str(a)])
end
Xdot =
Directional field
syms x c;
ezplot(x==c^2);
legend('case: c=0');
figure; ezplot(x==+sqrt(c));
hold on;
ezplot(x==-sqrt(c));
legend('Case: c>0');
figure; ezplot(x==+i*sqrt(c));
hold on;
ezplot(x==-i*sqrt(c));
legend('Case: c<0');
Bifurcation diagram
Function yue_bifur: plots 1D bifurcation figure Input: fun = some function @(x,para) x0 = initial value
of x a0 = the start value of parameter a a1 = the end value of parameter a N = the number of
intervals for parameter L = the number of iterations for each initial pair of (x0,parameter a)
p_siz = the marker size, default 1 Output: mat = bifucation matrix with size N by L which stores a
length L sequence for each pair of (x0,parameter a)
-------------------------------------------------
figure
fun = @(x,a) x*x - a;
x0 = .4; a0 = 0; a1 = 4; N = 100; L = 50;
mat = yue_bifur(fun,x0,a0,a1,N,L);
% ---------------------------------------------------
xlabel('a')
ylabel('x')
title( 'Bifurcation diagram')
Published with MATLAB® R2017a
3 . Analytical solution
dx
x2 a
dt
dx
dt
x a
2
dx
dt
x a x a
1 1 1
x a x a
2 a x a
2 a x a
dx dx
dt
2 a x a
2 a x a
1 1
x a x a dx 2 adt
ln x a ln x a 2 at C
ln
x a
2 at C
x a
d 2x
m 2
ko x x 3 0
dt
2
d x 1
ko x x 3
dt 2 m
d 2 x ko
2
x x3
dt m m
For fixed points
ko
x x3 0
m m
k
x o x 2 0
m m
k
x0 or o x 2 0
m m
ko 2
x 0
m m
2 ko
x
m m
k
x2 o
x k
so
Fixed po int s
x 0, k , k
2- Units of x are in meters and time in seconds
Then
d 2x
F ma m
dt 2
d 2x kgm 2
m 2 N 2
dt s
d 2 x m2
dt 2 s 2
kgm 2
s2
m 2 kg
m
s2
kgm 2
o o 2
k x k m N
s
kgm 2
s2
N kgm
ko
m m s 2
and
kgm 2
x3 N 2
s
kgm 2
x3 m3 2
s
N kgm kg
2
3 3 2 2
m m s ms
So Answer is
m kg
ko
N kgm
m s
2
N kgm2 kg
3 2
m m s ms
3 2
3 - Transforming second order differential equation into a set of ordinary differential equations
d 2x
m ko x x 3 0
dt 2
d 2x 1
2
ko x x 3
dt m
d x ko
2
2
x x3
dt m m
Lets take
dx
V
dt
SO, we can write
d 2 x dV
dt 2 dt
dV
m ko x x 3 0
dt
dV 1
ko x x 3
dt m
dV ko
x x3
dt m m
The set of resultant ODEs is as follow
dx
V
dt
dV ko
x x3
dt m m
clc
clear all
clf
close all
global k m mu
k = 1.0
mu = 0.5
m =1
Omega = sqrt(k/m)
T= 2*pi/Omega;
x0=1;
xdot_0=0;
X0 = [1 0];
tspan = [0 10*T];
%
[t X] = ode45(@DuffOSC,tspan,X0);
x = X(:,1);
xdot = X(:,2);
t_T = t/T;
figure
subplot(2,1,1)
plot(x,xdot)
xlabel('Displacement, x [m]')
ylabel('Velocity, xdot [m/s]')
title([' Initial conditions : x(0) = ',num2str(x0),' xdot(0) = ',num2str(xdot_0)])
subplot(2,1,2)
plot(t_T,x)
xlabel('Time, t/T [-]')
ylabel('Displacement, x [m]')
figure
plot(t_T,xdot)
xlabel('Time, t/T [-]')
ylabel('Velocity, xdot [m/s]')
title([' Initial conditions : x(0) = ',num2str(x0),' xdot(0) = ',num2str(xdot_0)])
dxdt = X(2);
dVdt = k/m*X(1) - mu/m*X(1).^3
dYdt = [dxdt;dVdt];
end
mu =
0.500000000000000
m=
Omega =
1
different init conditions
xdot_0=1;
x0=1;
X0 = [x0 xdot_0];
tspan = [0 10*T];
[t X] = ode45(@DuffOSC,tspan,X0);
x = X(:,1);
xdot = X(:,2);
t_T = t/T;
figure
subplot(2,1,1)
plot(x,xdot)
xlabel('Displacement, x [m]')
ylabel('Velocity, xdot [m/s]')
title([' Initial conditions : x(0) = ',num2str(x0),' xdot(0) = ',num2str(xdot_0)])
subplot(2,1,2)
plot(t_T,x)
xlabel('Time, t/T [-]')
ylabel('Displacement, x [m]')
title([' Initial conditions : x(0) = ',num2str(x0),' xdot(0) = ',num2str(xdot_0)])
Different init conditions
xdot_0=6;
x0=-1;
X0 = [x0 xdot_0];
tspan = [0 10*T];
[t X] = ode45(@DuffOSC,tspan,X0);
x = X(:,1);
xdot = X(:,2);
t_T = t/T;
figure
subplot(2,1,1)
plot(x,xdot)
xlabel('Displace, x [m]')
ylabel('Velocity, xdot [m/s]')
title([' Initial conditions : x(0) = ',num2str(x0),' xdot(0) = ',num2str(xdot_0)])
subplot(2,1,2)
plot(t_T,x)
xlabel('Time, t/T [-]')
ylabel('Displacement, x [m]')
title([' Initial conditions : x(0) = ',num2str(x0),' xdot(0) = ',num2str(xdot_0)])
Different parametr
k=0.2;
mu=0.7;
m=10;
Omega = sqrt(k/m);
T= 2*pi/Omega;
xdot_0=-7.6;
x0=0;
X0 = [x0 xdot_0];
tspan = [0 10*T];
[t X] = ode45(@DuffOSC,tspan,X0);
x = X(:,1);
xdot = X(:,2);
t_T = t/T;
figure
subplot(2,1,1)
plot(x,xdot)
xlabel('Displace, x [m]')
ylabel('Velocity, xdot [m/s]')
title([' Initial conditions : x(0) = ',num2str(x0),' xdot(0) = ',num2str(xdot_0)])
subplot(2,1,2)
plot(t_T,x)
xlabel('Time, t/T [-]')
ylabel('Displacement, x [m]')
title([' Initial conditions : x(0) = ',num2str(x0),' xdot(0) = ',num2str(xdot_0)])