声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 907|回复: 1

[综合讨论] 弱弱的问下:怎么调用函数????

[复制链接]
发表于 2009-4-7 16:35 | 显示全部楼层 |阅读模式

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

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

x
这里有个计算阶跃响应的特征参数程序,我如果想计算y=1./(t.^2+t+1)的动态性能指标
用下面的程序怎么调用,具体调用步骤是???

是在命令窗口中 输入stepchar(2,1./(t.^2+t+1))吗????
取t=2  


程序如下:
% MATLAB PROGRAM 2-5
function [pos,tr,ts2,tp]=stepchar(t,y)
% Finding pos and tp
[mp,ind]=max(y);dimt=length(t);yss=y(dimt);
pos=100*(mp-yss)/yss;tp=t(ind);
%Finding rise time tr
i=1;j=1;k=1;q=1;
while y(i)<0.1;
    i=i+1;
end;
t1=t(i);
while y(j)<0.9;
    j=j+1;
end;
t2=t(j);tr=t2-t1;
%Finding settling time (two percent)ts
i=dimt+1;n=0;
while n==0,
    i=i-1;
    if i==1,
        n=1;
    elseif y(i)>=1.02,
        n=1;
    end;
end;
t1=t(i);i=dimt+1;n=0;
while n==0,
    i=i-1;
    if y(i)<=0.98,
        n=1;
    end;
    t2=t(i);
    if t1>t2;
        ts2=t1;
    else
        ts2=t2;
    end
end

[ 本帖最后由 yunzhonggei 于 2009-4-7 17:03 编辑 ]
回复
分享到:

使用道具 举报

发表于 2009-4-7 19:02 | 显示全部楼层

回复 楼主 yunzhonggei 的帖子

程式不是LZ写的吗? 不然怎不知该喂什麽?
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-9-22 16:56 , Processed in 0.059640 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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