高分求matlab高手解释一下代码含义。

来源:百度知道 编辑:UC知道 时间:2024/05/05 12:56:18
[n,Omgc]=buttord(Omgp,Omgs,Rp,As,'s') %计算阶数n和截止频率:

if nargin == 4 %如果输入变量数是4
opt = 'z';
elseif nargin == 5
if ~strcmp(opt,'z') & ~strcmp(opt,'s')
error('Invalid option for final argument.');
end
end

msg=freqchk(wp,ws,opt);
error(msg);

ftype = 2*(length(wp) - 1);
if wp(1) < ws(1)
ftype = ftype + 1; % low (1) or reject (3)
else
ftype = ftype + 2; % high (2) or pass (4)
end

% first, prewarp frequencies from digital (unit circle) to analog (imag. axis):
if strcmp(opt,'z') % digital
WP=tan(pi*wp/2);
WS=tan(pi*ws/2);
else % don't have to if analog already
WP=wp;
WS=ws;
end
%note - on old systems that are NOT case sensitive, this will still work OK

% next, transform to low pass prototype with passband edge of 1 and stopband
% edges determined by the following: (see Rabi

1.matlab不支持中文的名字。
m文件可以取任何英文名字

2.randn(1,length(t))是生成一个随机分布的1×(t的长度)的正态分布的数组。

3.最后一个是生成P是一个Y.×Y的共轭矩阵。

要搞清楚什么意思,首先要知道里面的函数的含义,以后再遇到什么问题去查查matlab函数库查询字典吧

参考资料:函数库