plotした順番をグラフ上に載せたいです
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
%以下のxx,yy,rrのデータが左から右に順に並んでいます。
%これらのデータを使って、xx,yyを中心、rrを半径とする円を描きます。
%その時に、中心、または半径が何番目のデータなのかを分かるようにしたいです。
%例えば、(x,y,r)=(50.066950000000006,-21.191500000000005,0.532964000000000)において、x,yをプロットして、x,yを中心として
%半径rの円を描くときに、x,yの近くに'3'とグラフ上にプロットして、何番目のデータなのか分かるようにしたいです。
xx = [44.831550000000007 45.691500000000005 50.066950000000006 50.695800000000006 51.276550000000000 51.808650000000000 52.291650000000004 52.725000000000001 53.108400000000010 49.285650000000004 49.858249999999998];
yy = [-27.816400000000002 -26.380000000000003 -21.191500000000005 -19.639650000000003 -18.069150000000000 -16.481500000000000 -14.878250000000001 -13.260890000000002 -11.630900000000000 -18.829300000000000 -17.256100000000000];
rr = [0.218137000000000 0.811415000000000 0.532964000000000 0.100335000000000 0.458376000000000 0.722335000000000 0.339282000000000 0.270349000000000 0.851049000000000 1.155250000000000 0.139085000000000];
%以下図形を描く
grid on
hold on
xlabel(" x(cm)","FontSize",24)
ylabel(" y(cm)","FontSize",24)
title("Event","FontSize",30)
ax = gca;
ax.FontSize = 16;
plot(xx,yy,"LineStyle","none","Color","b","Marker",".")
centers = [xx' yy'];
viscircles(centers,rr,"Color","r");
0 comentarios
Respuestas (1)
Atsushi Ueno
el 24 de En. de 2022
text関数が適します。複数個所に異なるテキストを表示するには、文字列のcell 配列を入力する必要があります。下記の様に作成すればうまくいきます。
cellstr(num2str((1:5)'))' % 例として1~5をtext関数に入力する為の形を作成
xx = [44.831550000000007 45.691500000000005 50.066950000000006 50.695800000000006 51.276550000000000 51.808650000000000 52.291650000000004 52.725000000000001 53.108400000000010 49.285650000000004 49.858249999999998];
yy = [-27.816400000000002 -26.380000000000003 -21.191500000000005 -19.639650000000003 -18.069150000000000 -16.481500000000000 -14.878250000000001 -13.260890000000002 -11.630900000000000 -18.829300000000000 -17.256100000000000];
rr = [0.218137000000000 0.811415000000000 0.532964000000000 0.100335000000000 0.458376000000000 0.722335000000000 0.339282000000000 0.270349000000000 0.851049000000000 1.155250000000000 0.139085000000000];
plot(xx,yy,"LineStyle","none","Color","b","Marker","."); hold on
viscircles([xx' yy'],rr,"Color","r");
text(xx,yy,cellstr(num2str((1:numel(xx))'))); % x,yの近くに何番目のデータなのか分かるように表示
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!