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

조회 수: 4 (최근 30일)
Mashrur Zawad . 2023년 8월 25일
편집: Voss . 2023년 8월 28일
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.

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

### 채택된 답변

Mathieu NOE 2023년 8월 28일
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이전 댓글 4개 표시이전 댓글 4개 숨기기
Mathieu NOE 2023년 8월 28일
as always, my pleasure
if my submission has helped you, do you mind accepting it ? tx

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

### 카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!