• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

大毕设-MATLAB-常用知识回顾

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

要用到FIR滤波器和抽样器下面研究这两个的Matlab实现:

Fir滤波器:

matlab上fir滤波器的关键字是fir1

在command窗口输入help fir1出现帮助文档:

>> help fir1
fir1 FIR filter design using the window method.                                              fir滤波器使用窗函数法设计
B = fir1(N,Wn) designs an N'th order lowpass FIR digital filter                         B = fir1(N,Wn)这样是设计一个N阶低通滤波器
and returns the filter coefficients in length N+1 vector B.                                以一个N+1阶向量的形式返回滤波器系数
The cut-off frequency Wn must be between 0 < Wn < 1.0, with 1.0                截止频率Wn在0~1之间
corresponding to half the sample rate. The filter B is real and                          1.0表示截止频率为半 采样率

has linear phase. The normalized gain of the filter at Wn is                              这样得到的滤波器B是实且线性相位
-6 dB.                                                                                                        截止频率处的增益Wn是-6dB

B = fir1(N,Wn,'high') designs an N'th order highpass filter.                             B = fir1(N,Wn,'high') 产生一个N阶高通滤波器
You can also use B = fir1(N,Wn,'low') to design a lowpass filter.                      B = fir1(N,Wn,'low') 可以产生N阶低通滤波器

If Wn is a two-element vector, Wn = [W1 W2], fir1 returns an                        如果Wn(Wn = [W1 W2])是二元向量,fir1函数返回一个N阶带通滤波器
order N bandpass filter with passband W1 < W < W2. You can                        通带是W1到W2, B = fir1(N,Wn,'bandpass')用来产生带通滤波器

also specify B = fir1(N,Wn,'bandpass'). If Wn = [W1 W2],                              B = fir1(N,Wn,'stop')产生带阻
B = fir1(N,Wn,'stop') will design a bandstop filter.

If Wn is a multi-element vector,                                                                   如果Wn是一个多元向量


Wn = [W1 W2 W3 W4 W5 ... WN],                                                             例如Wn = [W1 W2 W3 W4 W5 ... WN], 
fir1 returns an order N multiband filter with bands                                         fir1函数产生一个多频带?滤波器
0 < W < W1, W1 < W < W2, ..., WN < W < 1.                                            0 < W < W1, W1 < W < W2, ..., WN < W < 1.                        
B = fir1(N,Wn,'DC-1') makes the first band a passband.                                B = fir1(N,Wn,'DC-1')表示第一个频带是通带
B = fir1(N,Wn,'DC-0') makes the first band a stopband.                                B = fir1(N,Wn,'DC-1')表示第一个频带是阻带

B = fir1(N,Wn,WIN) designs an N-th order FIR filter using                             B = fir1(N,Wn,WIN) ,WIN是长度为N+1的窗的向量,会产生一个N阶脉冲响应
the N+1 length vector WIN to window the impulse response.
If empty or omitted, fir1 uses a Hamming window of length N+1.                 如果没有参数WIN,fir1函数会默认使用长度为N+1的汉明窗
For a complete list of available windows, see the help for the                       查看窗函数了解更多WIN的知识
WINDOW function. KAISER and CHEBWIN can be specified with an              可以这样添加窗函数
optional trailing argument. For example, B = fir1(N,Wn,kaiser(N+1,4)) 
uses a Kaiser window with beta=4. B = fir1(N,Wn,'high',chebwin(N+1,R))      
uses a Chebyshev window with R decibels of relative sidelobe
attenuation.

For filters with a gain other than zero at Fs/2, e.g., highpass    
and bandstop filters, N must be even. Otherwise, N will be    
incremented by one. In this case the window length should be
specified as N+2.

By default, the filter is scaled so the center of the first pass band
has magnitude exactly one after windowing. Use a trailing 'noscale'
argument to prevent this scaling, e.g. B = fir1(N,Wn,'noscale'),
B = fir1(N,Wn,'high','noscale'), B = fir1(N,Wn,wind,'noscale'). You
can also specify the scaling explicitly, e.g. fir1(N,Wn,'scale'), etc.

% Example 1:
% Design a 48th-order FIR bandpass filter with passband
% 0.35 <= w <= 0.65.

b = fir1(48,[0.35 0.65]); % Window-based FIR filter design
freqz(b,1,512) % Frequency response of filter

% Example 2:
% The chirp.mat file contains a signal, y, that has most of its power
% above fs/4, or half the Nyquist frequency. Design a 34th-order FIR
% highpass filter to attenuate the components of the signal below
% fs/4. Use a cutoff frequency of 0.48 and a Chebyshev window with
% 30 dB of ripple.

load chirp; % Load data (y and Fs) into workspace
y = y + 0.5*rand(size(y)); % Adding noise
b = fir1(34,0.48,'high',chebwin(35,30)); % FIR filter design
freqz(b,1,512); % Frequency response of filter
output = filtfilt(b,1,y); % Zero-phase digital filtering
figure;
subplot(211); plot(y,'b'); title('Original Signal')
subplot(212); plot(output,'g'); title('Filtered Signal')

See also kaiserord, fircls1, fir2, firls, fircls, cfirpm,
firpm, freqz, filter, window, designfilt.

 

help fft                                                                                                     fft函数
fft Discrete Fourier transform.                                                                    fft离散傅里叶变换
fft(X) is the discrete Fourier transform (DFT) of vector X. For                        fft(X)表示对向量X做离散傅里叶变换
matrices, the fft operation is applied to each column. For N-D
arrays, the fft operation operates on the first non-singleton
dimension.

fft(X,N) is the N-point fft, padded with zeros if X has less                             fft(X,N) 对X做N点傅里叶变换,X点数不够补0有多截断
than N points and truncated if it has more.

fft(X,[],DIM) or fft(X,N,DIM) applies the fft operation across the
dimension DIM.

For length N input vector x, the DFT is a length N vector X,
with elements
N
X(k) = sum x(n)*exp(-j*2*pi*(k-1)*(n-1)/N), 1 <= k <= N.
n=1
The inverse DFT (computed by IFFT) is given by
N
x(n) = (1/N) sum X(k)*exp( j*2*pi*(k-1)*(n-1)/N), 1 <= n <= N.
k=1

See also fft2, fftn, fftshift, fftw, ifft, ifft2, ifftn.

fft 的参考页
名为 fft 的其他函数


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
delphi控件使用发布时间:2022-07-18
下一篇:
matlabreportgenerator发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap