Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# matlab-filters

Posted on 2006-04-26
Medium Priority
411 Views
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.
0
Question by:hsuyf
• 2

LVL 2

Accepted Solution

gordonkennedy earned 2000 total points
ID: 16551145
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

Author Comment

ID: 16552442
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

LVL 2

Expert Comment

ID: 16583862
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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
###### Suggested Courses
Course of the Month10 days, 4 hours left to enroll