How plot the systems with perturbation term?

조회 수: 4 (최근 30일)
salim
salim 2025년 6월 29일
편집: salim 2025년 6월 30일
is been a while i am searching for find a good option of ploting in my search i found some usefull one but i need to seperate them becuase background size of picture is not what i want and i want them solo and if there is any other better option of plotting the system please provide it here thanks
de1 = diff(u(t), t) == v(t);
de2 = diff(v(t), t) == -K(1) * u(t) ^ 3 + K(2) * u(t) + epsilon * sin(theta * t);
  댓글 수: 5
salim
salim 2025년 6월 29일
Torsten
Torsten 2025년 6월 29일
Something like this ?
% Chaotic System Visualization - Forced Duffing Oscillator
% Based on: du/dt = v, dv/dt = -K1*u^3 + K2*u + epsilon*sin(theta*t)
%% Parameters (adjust these to explore different chaotic behaviors)
K1 = 1.0; % Cubic nonlinearity coefficient
K2 = -1.0; % Linear restoring force coefficient
epsilon = 1.0; % Forcing amplitude
theta = 1.2; % Forcing frequency
f = @(t,y)[y(2);-K1*y(1)^3+K2*y(1)+epsilon*sin(theta*t)];
tspan = [0 100];
y0 = [1;0];
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
[T,Y] = ode45(f,tspan,y0);
plot(Y(:,1),Y(:,2))

댓글을 달려면 로그인하십시오.

답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2025년 6월 29일
You can work around what Torsten suggested to enhance the resolution of simulation results and get the simulation for other values of epsilon, e.g.:
% Chaotic System Visualization - Forced Duffing Oscillator
% Based on: du/dt = v, dv/dt = -K1*u^3 + K2*u + epsilon*sin(theta*t)
%% Parameters (adjust these to explore different chaotic behaviors)
K1 = 1.0; % Cubic nonlinearity coefficient
K2 = -1.0; % Linear restoring force coefficient
epsilon = 0.5:.5:2; % Forcing amplitude
theta = 1.2; % Forcing frequency
LT = {'r-'; 'g-'; 'b-'; 'm-'}; % Line color spec
for ii = 1:numel(epsilon)
f = @(t,y)[y(2);-K1*y(1)^3+K2*y(1)+epsilon(ii)*sin(theta*t)];
tspan = linspace(0,100, 1e5);
y0 = [1;0];
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
[T,Y] = ode45(f,tspan,y0);
figure(ii)
plot(Y(:,1),Y(:,2), LT{ii})
title(['Phase portrait: (\epsilon = ' num2str(epsilon(ii)) ')'])
grid on
xlabel('u')
ylabel('v')
end
  댓글 수: 1
salim
salim 2025년 6월 29일
@Sulaymon Eshkabilov thank you so much, can we have 3D chaotic plot of each the plot too ?
also do you have any idea about poincare map of the system? and if have a good shape of phase portrait it will be great i have it but i need more option of plot

댓글을 달려면 로그인하십시오.


Sulaymon Eshkabilov
Sulaymon Eshkabilov 2025년 6월 29일
Here is how 3D plot can be generated, e.g.:
% Chaotic System Visualization - Forced Duffing Oscillator
% Based on: du/dt = v, dv/dt = -K1*u^3 + K2*u + epsilon*sin(theta*t)
%% Parameters (adjust these to explore different chaotic behaviors)
K1 = 1.0; % Cubic nonlinearity coefficient
K2 = -1.0; % Linear restoring force coefficient
epsilon = 0.5:.5:2; % Forcing amplitude
theta = 1.2; % Forcing frequency
LT = {'r-'; 'g-'; 'b-'; 'm-'}; % Line color spec
for ii = 1:numel(epsilon)
f = @(t,y)[y(2);-K1*y(1)^3+K2*y(1)+epsilon(ii)*sin(theta*t)];
tspan = linspace(0,100, 1e5);
y0 = [1;0];
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
[Time,Y] = ode45(f,tspan,y0);
figure(ii)
plot3(Time, Y(:,1),Y(:,2), LT{ii})
title(['Phase portrait: (\epsilon = ' num2str(epsilon(ii)) ')'])
grid on
xlabel('Time')
ylabel('u')
zlabel('v')
end
  댓글 수: 2
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2025년 6월 29일
Here are some starting points on a Poincare map:
K1 = 1.0; % Cubic nonlinearity coefficient
K2 = -1.0; % Linear restoring force coefficient
epsilon = 0.5:.5:2; % Forcing amplitude
theta = 1.2; % Forcing frequency
LT = {'ro'; 'g*'; 'bd'; 'mp'}; % Marker color for Poincare maps
T = 2*pi/theta; % Forcing period
nPeriods = 300; % Number of stroboscopic samples (adjust for clarity)
for ii = 1:numel(epsilon)
f = @(t,y)[y(2); -K1*y(1)^3 + K2*y(1) + epsilon(ii)*sin(theta*t)];
tspan = linspace(0, nPeriods*T, 1e5); % Simulate multiple periods
y0 = [1; 0];
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
[Time,Y] = ode45(f, tspan, y0, options);
% Poincare section at multiples of forcing period T:
poincare_points = [];
t_samples = (0:nPeriods-1) * T;
for k = 1:length(t_samples)
% Find closest time index:
[~, idx] = min(abs(Time - t_samples(k)));
poincare_points = [poincare_points; Y(idx,1), Y(idx,2)];
end
% Plotting Poincare map simulation results:
figure(ii)
plot(poincare_points(:,1), poincare_points(:,2), LT{ii}, 'MarkerSize', 6)
title(['Poincaré Map (\epsilon = ' num2str(epsilon(ii)) ')'])
xlabel('u'); ylabel('v');
axis tight
grid on
end
salim
salim 2025년 6월 29일
편집: salim 2025년 6월 29일
@Sulaymon Eshkabilov why our poincare is so different i find it from another paper the same problem but poincare is so different, what is make my poincare be like that ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by