如何用matlab给地图标点? matlab标点

3317℃ ALFONSO

如何用matlab给地图标点?matlab标点

如何在matlab的图中标点?

先用hold on;命令把画图窗口保持住

用命令plot3(x,y,z,s)

x,y,z为点的空间坐标,s是该点的形状,颜色

matlab如何在图上标点

1、下面演示一下第一种标记方式。

代码:

%本程序完成对一些特殊点的标记

clc;clear all

x=0:0.01:2*pi;

y=sin(x);

p=find(y==max(y));

plot(x,y,'r','linewidth',2)

grid on

text(x(p),y(p),'o','color','g')

axis([0 2*pi -1.4 1.4])

2、完成标记后的图像如下(图中绿色的小圆圈)。

3、第二类标法同理,代码如下:

%本程序完成对一些特殊点的标记

clc;clear all

x=0:0.01:2*pi;

y=sin(x);

p=find(y==max(y));

plot(x,y,'r','linewidth',2)

grid on

axis([0 2*pi -1.4 1.4])

text(x(p),y(p),['(',num2str(x(p)),',',num2str(y(p)),')'],'color','b');

4、然后得到的效果在下面可以看到。

如何在matlab的图中标点?

surf(某某)

hold on;

plot3(某某)

matlab怎么在图上标出具体点坐标?

对巳知坐标的点,可以这样标出:

plot(5,38.45,'rs','MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',5)

text(5,38.45,'(5,38.45)','EdgeColor','red','VerticalAlignment','bottom');

plot(38,126.36,'rs','MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',5)

text(38,126.36,'(38,126.36)','EdgeColor','red','VerticalAlignment','bottom');

对未知坐标的点,可以先插值,再标出:

以下代码在7.1版以上均可运行。

close all

clear,clc

x=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39];

y2=[0 3.75 10.95 19.95 29.3 38.45 46.85 54.50 61.55 68.00 73.85 78.95 83.75 88.25 92.3 95.9 99.2 102.2 104.9 107.3 109.55 111.65 113.6 115.4 117.05 118.55 119.9 121.1 122.15 123.05 123.8 124.4 124.85 125.25 125.61 125.91 126.11 126.26 126.36 126.44];

plot(x,y2);

hold on;

y3=126.44;

plot(x,y3,'-');

% Set up fittype and options.

ft = 'linearinterp';

opts = fitoptions( ft );

opts.Normalize = 'on';

% Fit model to data.

fitresult = fit( x', y2', ft, opts );

xx1 = [6.321,11.15,21.15]; % x = [6.321,11.15,21.15]

yy1 = fitresult( xx1 ); % 与x对应的y值

% 画点 标注

for i = 1:length(xx1)

plot(xx1(i),yy1(i),'rs','MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',6)

text(xx1(i),yy1(i),['(',num2str(xx1(i),'%5.2f'),',',num2str(yy1(i),'%5.2f'),')'],'EdgeColor','red','BackgroundColor',[.7 .9 .7],'VerticalAlignment','bottom');

end

TAG: 标点 地图