plotting the points near to origin

조회 수: 3 (최근 30일)
sampath kumar punna
sampath kumar punna 2019년 10월 29일
댓글: sampath kumar punna 2019년 10월 29일
X Y
18 10
72 28
43 28
43 61
24 43
10 55
22 24
51 75
52 75
21 41
39 35
9 31
30 60
25 10
19 37
55 75
22 33
18 61
31 39
33 15
22 24
42 43
13 16
70 46
70 74
here is my x and y values, if i plot my graph i get it as shown below but i dont my graph with all points of my data
i wanted my graph like this as shown below, only the highlited part which is near to the zero, i want some points like 10-15 values which are near to the point zero from my data, and can i get values the points.
please can you help me to do this, which will be very help full for my execution
thanks

채택된 답변

Rik
Rik 2019년 10월 29일
Your data doesn't seem to fit your plots. The code below should give you an idea of how you could do this. You could also define a cutoff distance and show everything below that distance.
X=XY(:,1);Y=XY(:,2);%XY is the array as you posted in your question
dist_to_origin=sqrt(X.^2+Y.^2);
[~,order]=sort(dist_to_origin);
plot(X(order(1:10)),Y(order(1:10)),'o')
axis([0 80 0 80])
%instead of order(1:10) you can also use this:
L=dist_to_origin<=45;
plot(X(L),Y(L),'o')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by