How to check a filter

조회 수: 7 (최근 30일)
Daniel
Daniel 2016년 5월 26일
댓글: Star Strider 2016년 5월 26일
i created a filter using FDATOOL. now i want to check it. i did : generate matlab code. got a mutlab function with the filter specification. ran the function and got a matlab object Hd. this is ment to be a HPF: samling at 20MHz Fstop 10KhZ Fpass 500KHz
i want to run this filter with a signal and see resault. thought about entering a sine function: not sure that its the right way, i coded:
Fs=20e6;
dt=1/Fs;
stopt=0.25;
t=(0:dt:stopt-dt)';
Fc=10e3;
x=sine(2*pi*Fc*t);
y=filter(Hd,x);
i expect not to see anything when setting the sine Fc below 10Khz but thats not the case now i am not sure i am doing things correct. would like to get some help

답변 (1개)

Star Strider
Star Strider 2016년 5월 26일
If you want to view the transfer function, use the freqz function.
See the documentation on it for all the options it provides.
  댓글 수: 2
Daniel
Daniel 2016년 5월 26일
i get the same plot i got from the fdatool. i want to test it. i want to pass a sine function through my filter and see what happens. cant seem to do that. i dont get a 1:1 on the pass band. and see a distorted signal. did i ran the filter correctly?
Star Strider
Star Strider 2016년 5월 26일
Use the filtfilt function, not filter. The first creates a phase-neutral (maximally flat phase response), and the other introduces phase distortion.
If your sin signal is near the filter cutoff frequency or in the transition region, it could be distorted even if you use filtfilt. That is likely since your filter has a very large transition region, going from 10 kHz to 500 kHz.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by