pb0322 发表于 2006-11-30 23:06

请教高手一个S函数(matlab内含)!!

谁能帮我注释一下这个S函数呢

function =pndanim1(t,x,u,flag,ts);
%PNDANIM3 S-function for animating the motion of a pendulum.

%   Ned Gulley, 6-21-93
%   Copyright 1990-2002 The MathWorks, Inc.
%   $Revision: 5.10 $

global PendAnim1

if flag==2,
if any(get(0,'Children')==PendAnim1),
    if strcmp(get(PendAnim1,'Name'),'simppend Animation'),
      set(0,'currentfigure',PendAnim1);
      hndlList=get(gca,'UserData');
      x=;
      y=;
      set(hndlList(1),'XData',x,'YData',y);
      set(hndlList(2),'XData',u(1),'YData',0);
      drawnow;
    end
end
sys=[];

elseif flag == 4 % Return next sample hit

% ns stores the number of samples
ns = t/ts;

% This is the time of the next sample hit.
sys = (1 + floor(ns + 1e-13*(1+ns)))*ts;

elseif flag==0,

% Initialize the figure for use with this simulation
animinit('simppend Animation');
= figflag('simppend Animation');
axis([-3 3 -2 2]);
hold on;

x=;
y=;
hndlList(1)=plot(x,y,'LineWidth',5,'EraseMode','background');
hndlList(2)=plot(0,0,'.','MarkerSize',25,'EraseMode','back');
set(gca,'DataAspectRatio',);
set(gca,'UserData',hndlList);

sys=;
x0=[];

end

pb0322 发表于 2006-11-30 23:08

请教高手

:@Q我查看了一些书,上面说这是比较老的S函数格式,看了半天我也没有读懂~~~:@Q

[ 本帖最后由 pb0322 于11:13 PM 编辑 ]
页: [1]
查看完整版本: 请教高手一个S函数(matlab内含)!!