I want to extract outer points of my plot(Chaotic Data Points) and plot it with the extracted outer points.

4 vues (au cours des 30 derniers jours)
alpha = 0;
% Initial conditions
x = 1;
y = 1;
z = 1;
% Time step
dt = 0.01;
% Arrays to store the trajectory points
x_traj = [];
y_traj = [];
z_traj = [];
% Loop over time
for t = 0:dt:300
% Calculate x', y', and z' for the current alpha
x_prime = (25*alpha + 10)*(y - x);
y_prime = (28 - 35*alpha)*x - x*z + (29*alpha - 1)*y;
z_prime = x*y - ((alpha+8)/3)*z;
% Update x, y, and z
x = x + dt*x_prime;
y = y + dt*y_prime;
z = z + dt*z_prime;
% Store the trajectory points
x_traj = [x_traj, x];
y_traj = [y_traj, y];
z_traj = [z_traj, z];
end
% Plot x and y
figure;
plot(x_traj, y_traj);
xlabel('x')
ylabel('y');
title('Phase Portrait: x and y');
grid on;
I have written this code and from this I have got the following plot
;
There are a lot of self intersecting points in this plot.So I want a exact shape but without using the selfintersecting points.Then I used Convhull command
convhull_indices = convhull(x_traj, y_traj);
plot(x_traj(convhull_indices), z_traj(convhull_indices), 'r');
and I got this plot
But this is not the excat representation of the previous shape
I am actually looking something like this.Which command or procedure I should use.

Réponse acceptée

Mathieu NOE
Mathieu NOE le 28 Août 2023
hello
maybe this ?
I needed to use a refine time increment dt (1/10th of the original value) so that the outer points are close enough to make the boundary smooth and not with zigzags between outer and more inner points
hope it helps
alpha = 0;
% Initial conditions
x = 1;
y = 1;
z = 1;
% Time step
dt = 0.001;
% Arrays to store the trajectory points
x_traj = [];
y_traj = [];
z_traj = [];
% Loop over time
for t = 0:dt:300
% Calculate x', y', and z' for the current alpha
x_prime = (25*alpha + 10)*(y - x);
y_prime = (28 - 35*alpha)*x - x*z + (29*alpha - 1)*y;
z_prime = x*y - ((alpha+8)/3)*z;
% Update x, y, and z
x = x + dt*x_prime;
y = y + dt*y_prime;
z = z + dt*z_prime;
% Store the trajectory points
x_traj = [x_traj; x];
y_traj = [y_traj; y];
z_traj = [z_traj; z];
end
% Plot x and y
figure;
plot(x_traj, y_traj);
hold on
xlabel('x')
ylabel('y');
title('Phase Portrait: x and y');
grid on;
% k = boundary(___,s) specifies shrink factor s using any of the previous syntaxes.
% s is a scalar between 0 and 1. Setting s to 0 gives the convex hull,
% and setting s to 1 gives a compact boundary that envelops the points.
% The default shrink factor is 0.5.
k = boundary(x_traj, y_traj,0.95);
plot(x_traj(k), y_traj(k), 'm');
  5 commentaires
Mathieu NOE
Mathieu NOE le 28 Août 2023
as always, my pleasure
if my submission has helped you, do you mind accepting it ? tx

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by