# matlab-filters

Hi experts,
I am very new at MATLAB but I am trying to pick a set of periodic and aperiodic signal (can be any signal) and then pass them trhough filters (like ideal low-pass, butterworth filters), and see the output signal and spectra.

but have no idea how to do it.  Any help would be appreciated.  Thank you in advance.
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Before you filter your data, you need to interpolate onto an equispaced timebase.
You might do this using something like :
>> samplePeriod = 0.1; %seconds
>> t = [min(waveformAperiodic):samplePeriod:max(waveformAperiodic)]';
>> waveformAperiodicEq = [t,interp1(waveformAperiodic(:,1),waveformAperiodic(:,2),t)];

Then you need choose a time constant for your first order filter and from this calculate a filter coefficient :
>> timeConst = 2; %seconds
>> filterCoeff = exp(-samplePeriod/timeConst);

Then you are ready to filter and then plot your data :
>> waveformAperiodicFiltered = [t, filter((1-filterCoeff ), [1 -filterCoeff ], waveformAperiodicEq(:,2), waveformAperiodicEq(1,2))];
>> plot(waveformAperiodic(:,1), waveformAperiodic(:,2), waveformAperiodicFiltered(:,1), waveformAperiodicFiltered(:,2))
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Hi Gordon

thank you very much for your help. Could you please give me a code example like you hlep me in the "amplitude/phase spectra" question? I am thinking about using a .wav file for my aperiodic source (instead of createing it) and pass it through filters (like ideal low-pass, butterworth filters). do you think it would be more easy to do?

I really need have some codes for this project, if you feel some parts (use in different filters) are difficult to do, please let me know. I will divide them into new question.
0
Commented:
Hello hsuyf,

The response I gave you above already does contain example Matlab code to achieve what you asked (using Matlab's standard filter function) ... so I am not clear what else you are asking for.

If you need extra information, please could you accept this answer, and then ask a new one ?

Thanks,
Gordon
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Math / Science

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.