MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 急,matlab求助,该怎么定义这个自定义函数 (https://www.labfans.com/bbs/showthread.php?t=11034)

北极小星 2010-03-17 13:02

急,matlab求助,该怎么定义这个自定义函数
 
一个matlab自定义函数A,其涵义如下:
当执行语句 A X0.0 Y0.0 Z0.0;
A X1.0 Y2.0 Z3.0;
A …… 时,
会产生两张图,第一张是散点图,有(0.0,0.0,0.0)、(1.0、2.0、3.0)等点,第二张则是将这些点依次连成直线的连线图。请问该如何编写这个函数的自定义程序。前半部分内容如下:
function A(varargin)
a=varargin{1}
b=varargin{2}
c=varargin{3}
a=str2num(a(2:end))
b=str2num(b(2:end))
c=str2num(c(2:end))
请帮忙补充后面部分。 当然如果前面部分有什么不妥的,也请指教。

mathjiang 2010-03-17 17:56

回复: 急,matlab求助,该怎么定义这个自定义函数
 
按自己理解写的语句:

function huatu(x)

subplot(2,1,1)
plot3(x(:,1),x(:,2),x(:,3),'*','markersize',6)%散点图
subplot(2,1,2)
plot3(x(:,1),x(:,2),x(:,3))%折线图


所有时间均为北京时间。现在的时间是 15:21

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.