plotting the points near to origin
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 Center 和 File 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!