# Matlab help? DSP filters.

Discussion in 'Programmer's Corner' started by wavread, Mar 9, 2011.

Mar 9, 2011
2
0
Hello,
I hope this is going in the right place on the board, but if not please tell me and I'll post elsewhere.
Anywayy.
As part of a project I have to import,play, analyse and then design a filter on Matlab to clean a piece of audio(WAVE). I've been going through the initial parts of importing the audio using Wavread, and playing using Wavplay, and that's all worked fine.
However I'm at the analysing stage now, and my tutor has given me a code to use which I don't really understand, and so I can't really make anything out from the plot's I've got.
So to get to the point I was wondering if anyone here had any idea of what the code I've used is doing? And if so how to interpret the plot's I've made with them.
This is what I've got so far
>> wavplay(y,fs)
>> mag=abs(fft(y));
>> f=fs*(0:length(y)-1)/length(y);
>> plot(f(1:500),mag(1:500))
>> stem(f(1:500),mag(1:500))

What's really confusing me is the section below. I'm just not sure what the code is trying to do.
>> mag=abs(fft(y));
>> f=fs*(0:length(y)-1)/length(y);

And these are the graphs that came out.

http://i52.tinypic.com/35an8md.jpg
http://i53.tinypic.com/qsmi3p.jpg

Do these mean that the filter I need to design needs to be a low pass, below 4500hz? or am I totally off the mark.

Also, I vaguely know where to start designing the filter, but is it easy to implement the filter from the FDA tool in Matlab to the code? Or will it be better to code one?

Any help is much appreciated.

2. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
The commands in question do nothing more than create a table of the magnitude Fast Fourier Transformation and the frequency axis.

It seems strange though that the main frequencies don't go over 50Hz. Does that mirror in the actual track? Is the base dominant?

The phrase "clean up the track" is a bit vague, but if I were you I would create a Low Pass filter with a corner frequency of 45Hz.

I 'm not sure how you will do that, but I 'm sure Matlab Help will have plenty of examples.

Mar 9, 2011
2
0