声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1388|回复: 1

[共享资源] 一个用鼠标选点、绘图的函数

[复制链接]
发表于 2007-11-28 01:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
% example
% t=1:4;a=t;
% plplot(t,a);

function pkplot=pkplot(t,a)
axis([t(1) t(end) min(a) max(a)]);
hold on
% Initially, the list of points is empty.
xy = [];
n = 0;
% Loop, picking up the points.
disp('Left mous e button picks points.')
disp('Right mouse button picks last point.')
but = 1;
while but == 1
    [xi,yi,but] = ginput(1);
    plot(xi,yi,'ro')
    n = n+1;
    xy(:,n) = [xi;yi];
end
% Interpolate with a spline curve and finer spacing.
t = 1:n;
ts = 1: 0.1: n;
xys = spline(t,xy,ts);
xys
% Plot the interpolated curve.
plot(xys(1,:),xys(2,:),'b-');
hold off

[ 本帖最后由 eight 于 2007-11-28 10:09 编辑 ]
回复
分享到:

使用道具 举报

发表于 2007-11-28 10:09 | 显示全部楼层
原帖由 aniso 于 2007-11-28 01:06 发表
% example
% t=1:4;a=t;
% plplot(t,a);

function pkplot=pkplot(t,a)
axis([t(1) t(end) min(a) max(a)]);
hold on
% Initially, the list of points is empty.
xy = [];
n = 0;
% Loop, picking u ...

这个貌似 help ginput 就有
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-18 09:31 , Processed in 0.048391 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表