永发信息网

求大神把这段MATLAB程序给注释下,在线等万谢!

答案:2  悬赏:40  手机版
解决时间 2021-03-07 11:45
  • 提问者网友:谁的错
  • 2021-03-06 13:31
设计椭圆模拟低通滤波器,其滤波器的阶数,3-dB截止频率,通带的波纹和阻带衰减由键盘输入,程序能根据输入的参数,绘制滤波器的增益响应。

clear;
N=input('Type in the order N = ');
Wn=input('Type in the 3-dB cutofffrequency Wn = ');
Rp=input('Type in the the passbandripple Rp = ');
Rs=input('Type in the the minimumstopband attenuation Rs = ');
[num,den]=ellip(N,Rp,Rs,Wn,'s');
w=0:5*Wn;
h=freqs(num,den,w);
plot(w,20*log10(abs(h))),grid;
xlabel('Frequency, Hz'); ylabel('Gain, dB');
最佳答案
  • 五星知识达人网友:一把行者刀
  • 2021-03-06 14:19
clear; %%% 清理变量
N=input('Type in the order N = ');%%% 获取输入值N
Wn=input('Type in the 3-dB cutofffrequency Wn = ');%%%获取输入值 Wn
Rp=input('Type in the the passbandripple Rp = '); %%%获取输入值 Rp
Rs=input('Type in the the minimumstopband attenuation Rs = '); %%%获取输入值 Rs
[num,den]=ellip(N,Rp,Rs,Wn,'s');%%%这是画椭圆的函数吗?
w=0:5*Wn;
h=freqs(num,den,w);%%%频谱获得
plot(w,20*log10(abs(h))),grid; %%%画图,x为w ,y为频谱的对数值(像是dB表示)
xlabel('Frequency, Hz'); ylabel('Gain, dB');
全部回答
  • 1楼网友:北方的南先生
  • 2021-03-06 15:33
clear all; close all; fs=2500; %采样率 fp=99,fc=105; %通带边界频率和截止频率 wp=2*pi*fp/fs; %频率做归一化处理 ws=2*pi*fc/fs; bt=ws-wp; %过渡带宽 n0=ceil(6.6*pi/bt); %确定滤波器长度 n=n0+mod(n0+1,2); %保证为奇数 wc=(wp+ws)/2/pi; %过渡带中心频率 hn=fir1(n-1,wc,hamming(n)); %汉明窗滤波器 freqz(hn,1,512); %绘制频率响应图 %%构造测试信号 f1=30;f2=45;f3=80;f4=93;f5=99;f6=130; %各频率分量(hz) t=0:0.01:2; %时长 x=0.5*cos(2*pi*f1*t)+0.3*cos(2*pi*f2*t)+0.2*cos(2*pi*f3*t)+0.7*cos(2*f4*pi*t)+0.8*cos(2*pi*f5*t)+0.6*cos(2*pi*f6*t); %测试信号 figure(5); subplot(211) plot(t,x); y=filter(hn,1,x); %时域滤波 title('滤波前信号'); subplot(212) plot(t,y); title('滤波后信号');
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯