Design of "matlab" Notch device

Source: Internet
Author: User

Source:

Design of the% notch filter
The transfer function of the% notch is
% B (1/z) (Z-exp (J*2*PI*F0)) * (Z-exp (-J*2*PI*F0))
%H (z) =--------=--------------------------------------------
% A (1/z) (Z-a*exp (J*2*PI*F0)) * (Z-a*exp (-J*2*PI*F0))
% of whichF0 is the frequency at which the notch filters out the signal,A is a parameter associated with the notch depth,A larger, deeper depth.
%
% of known signals50Hz Power frequency interference, the signal isX=sin (2*pi*50*n*ts) +sin (2*pi*125*n*ts);
% requires filter by notch filter50Hz interference Signal
% parameter setting: sample ratets=0.001s, sample length:512 pips
Clf;clear;
% Set Initial value
f0=50;
ts=0.001;
Fs=1/ts;
nlen=512;
n=0:nlen-1;
Design of the% notch filter
Apha=-2*cos (2*pi*f0*ts);
beta=0.96;
B=[1 APHA 1];
A=[1 Apha*beta beta^2];
Figure (1);
FREQZ (B,A,NLEN,FS);% notch feature display
X=sin (2*pi*50*n*ts) +sin (2*pi*125*n*ts);% original signal
Y=dlsim (b,a,x);% notch filter processing
% The frequency domain transform of the signal.
Xfft=fft (X,nlen);
Xfft=xfft.*conj (XFFT)/nlen;
Y1=fft (Y,nlen);
Y2=y1.*conj (y1)/nlen;
Figure (2);% filter before and after the signal comparison.
Subplot (2,2,1);p lot (n,x);
Xlabel (' time (s) '); Ylabel (' amplitude '); title (' Input Signal ');
Subplot (2,2,3);p lot (n,y);
Xlabel (' time (s) '); Ylabel (' amplitude '); title (' Filter output ');
Subplot (2,2,2);p lot (n*fs/nlen,xfft), axis ([0 fs/2 min (xfft) max (XFFT)]), grid;
Xlabel (' Frequency (Hz) '); Ylabel (' Magnitude (DB) '); title (' Input Signal ');
Subplot (2,2,4);p lot (n*fs/nlen,y2), axis ([0 fs/2 min (y2) max (y2)]), grid;
Xlabel (' Frequency (Hz) '); Ylabel (' Magnitude (DB) '); title (' Filter output ') ;

Design of "matlab" Notch device

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.