Matlab tidbits

Here’s how you’d implement a low pass butterworth filter in matlab. This has come in very handy.

lowcutoff=1000;
sampling_freq=12000;
fNorm=lowcutoff/(sampling_freq/2);
[b,a] = butter(10, fNorm, 'low');
filtered_signal = filtfilt(b, a, signal);
Here’s how you’d add (gaussian white) noise:
noisy_data=awgn(data, SNR)
Matlab can be a real pain when trying to save CSV files with different data types (string + numeric: lets say). But to try things like SVN and Naive Bayes on weka, you need your labels to be nominal (not numeric). Fortunately, this guy wrote this codeĀ which works like a charm. All you have to do (after downloading that file) is :
cell2csv ( 'filename.csv', cell_array_that_you_want_to_write, ' , ');

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>