need some help with implementting a lpf filter
조회 수: 1 (최근 30일)
이전 댓글 표시
hello everyone,
In the attached time-domain signal i want to filter a noise which exists somewhere in 2.25 seconds . My goal is to get as close as clean Rectangle with a clear and sharp rise.
Searching after the noise location, i looked after the FFT of the signal , expecting to get a sinc signal in the Freq-domain (Rectangle in time-domain equals to sinc in frequency-domain). After i did it, i guessed (after some computation with myself) that the noise is from 0.8*pi and on.
My problem is implementing that filter. can someone help me please ?
thanks a lot.
댓글 수: 1
Image Analyst
2014년 1월 14일
Nothing is attached. Make sure you click the Attach file button after you click the Choose file button.
답변 (2개)
Image Analyst
2014년 1월 10일
편집: Image Analyst
2014년 1월 10일
The FT of a single rect is a sinc. You don't have that. You have two rects plus a step. What do you think the FT of that will be?
Anyway, the way to get a sharp digital signal output is simply
goodSignal = 0.04 * double(badSignal > 0.02);
No need for fft or anything. Why make it harder than it needs to be!?!?
댓글 수: 2
Image Analyst
2014년 1월 10일
kobi's "Answer" moved here since it is not an answer to the original question but actually a reply to me:
hi and thanks for the quick answer.
What is the meaning of that code : goodSignal = 0.04 * double(badSignal > 0.02); ? why to multiply by 0.04 ? what's that "badSignal > 0.02" suppose to mean ?
i don't understand the reason behind it...
Image Analyst
2014년 1월 10일
This is super basic stuff so if you read the "Getting started" section of the help you'll learn a lot more essential things like this. In the meantime,
badSignal > 0.02
means that your signal, which I'm assuming has been read in and stored in a variable called badSignal, is compared to 0.02. This will create a logical vector - a 1-D list with the same number of elements as badSignal where the value is either true or false depending on whether is is more than 0.02 or not.
Then I pass that into double() so that the vector of [false, false, true, true, .....] is converted into a double vector of [0.0, 0.0, 1.0, 1.0, .....].
Then we have a digital signal where the signal is exactly 0 or 1 depending on whether the noisy badSignal is lower or higher than 0.02. But you don't want it to have a value of 1 at the tops, you want a value of 0.04 , so I multiply the signal by 0.04. All the zeros remain zero since 0.04 * 0 = 0, but all the 1's change into 0.04 since 0.04 * 1 = 0.04. So a signal that was [0.0, 0.0, 0.04, 0.04, .....]
That's about as high a level of explanation detail I can think of, so I hope you followed it and understand it.
kobi
2014년 1월 14일
편집: kobi
2014년 1월 14일
댓글 수: 1
Image Analyst
2014년 1월 14일
You can either try filtering with a box of varying widths until the spikes are suppressed to your satisfaction, using imfilter() or conv2(), or you can zero out the high spatial frequencies and keep dropping the cutoff frequency until the spikes in the time domain go away to your satisfaction.
참고 항목
카테고리
Help Center 및 File Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!