NOTE : This is not a matlab tutorial, this is my private Matlab notebook .. so do not expect too many comments. :)

Import LVM file

you can import LVM file by using lvm_import('file') from here
it returns a struc


usage similar to objects in C …. for example …;

Rows and Columns

Lets assume we have a matrix Nx3
then to get second column we need to type : b(:,2)


nice filter example based on wav file

Example on Band Path Filter

n = 6;
% Frequencies to keep is between 200 to 800, while the sampling frequency is 4kHz, which leads to half frequency of 2kHz.
f = 4000
Wn = [200 800]/(f/2)

It is also possible to see the frequency response of the filter …
lets assume at f=4,000Hz …


Export Images of High Resolution

This example exports Figure No. 1 at a resolution of 300 dpi to a 24-bit JPEG file, myfigure.jpg.

print -djpeg -f1 -r300 myfigure



can be useful to check the distribution …

hist(data, number)

data is the data array …. number is the number of the bars to divide the histogram for … 7 is ok …



I spent so long trying to figure out how to change labels and their size in BoxPlot Matlab. Here I am jotting down my discoveries, and hopefully google would spread the knowledge for others to follow.

set(gca,'XTick',[1 2 3 4 5 ], 'XTickLabel',{'L-2' 'L0' 'L2' 'L2' 'L2'}, 'FontSize', 20 );

Interestengly, if you take the XTick off, it would not work !
There are more explanations on how to make it through childrens,pointers, and other non-direct approaches here

Plotting ErrorBars

Ploterr is a nice tool to plot horisontal or vertical erorr bars : []

Fitting a line

very nice explanation is here : []

Simple Linear Polyfit

p=polyfit(x, y,1);
plot(xx,f,'-',x, y,'o');

Complicated one

fminsearch - give it a function and it would find the correlation …


check correlation coefficiency

give it measured values and estimated, it would calculate the R ..

correlation=corrcoef( y_err , weight_estimate )

Pretty graphs …

Copyright (c) 2009