matlab仿真一直出现错误Ft=8000; Fp=100; Fs=150; As=50; Ap=1;dlp=fdesign.lowpass(Fp,Fs,Ap,As,Ft);hdlp=design(dlp,'cheby1');[b,a] = sos2tf(hdlp.sosMatrix, hdlp.ScaleValues); [h,w]=freqz(b,a); %得到频率响应 plot(w*8000*0.5/pi,abs(h)
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 01:41:06
matlab仿真一直出现错误Ft=8000; Fp=100; Fs=150; As=50; Ap=1;dlp=fdesign.lowpass(Fp,Fs,Ap,As,Ft);hdlp=design(dlp,'cheby1');[b,a] = sos2tf(hdlp.sosMatrix, hdlp.ScaleValues); [h,w]=freqz(b,a); %得到频率响应 plot(w*8000*0.5/pi,abs(h)
matlab仿真一直出现错误
Ft=8000; Fp=100; Fs=150; As=50; Ap=1;
dlp=fdesign.lowpass(Fp,Fs,Ap,As,Ft);
hdlp=design(dlp,'cheby1');
[b,a] = sos2tf(hdlp.sosMatrix, hdlp.ScaleValues);
[h,w]=freqz(b,a); %得到频率响应
plot(w*8000*0.5/pi,abs(h));%绘制频率响应
这是sos2tf函数
function [b,a] = sos2tf(sos,g)
error(nargchk(1,2,nargin))
if nargin == 1,
g = 1;
end
[L,n] = size(sos);
if n = 6,
error('SOS matrix must have six columns.');
end
if L == 0,
b = [];
a = [];
return
end
b = 1;
a = 1;
for m=1:L,
b1 = sos(m,1:3);
a1 = sos(m,4:6);
b = conv(b,b1);
a = conv(a,a1);
end
b = b.*g;
if length(b) > 3,
if b(end) == 0,
b(end) = []; % Remove trailing zeros if any for order > 2
end
end
if length(a) > 3,
if a(end) == 0,
a(end) = []; % Remove trailing zeros if any for order > 2
end
end
matlab仿真一直出现错误Ft=8000; Fp=100; Fs=150; As=50; Ap=1;dlp=fdesign.lowpass(Fp,Fs,Ap,As,Ft);hdlp=design(dlp,'cheby1');[b,a] = sos2tf(hdlp.sosMatrix, hdlp.ScaleValues); [h,w]=freqz(b,a); %得到频率响应 plot(w*8000*0.5/pi,abs(h)
sos2tf函数维数不匹配,给那设置个断点,用whos函数看看