plotting the points near to origin
1 回表示 (過去 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/245428/image.jpeg)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/245429/image.jpeg)
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!