Sunday, February 20, 2011

Matlab Answers Central

Matlab has opened up with answers. This is awesome as this can serve as a place for users to interact and post the problems, and possibly the solutions.
They have some system of having points as in yahoo answers, but other than feeling better that the poster helped to solve the problem, I am not sure what does that score mean.

http://www.mathworks.com/matlabcentral/answers/

Monday, November 29, 2010

Can't create index output file in texnic center

I was beating my day because the index was not being printed on the report.
Later, after a good number of search(es),  I found that this is interesting feature of MikTex 2.9

The problem was solved by changing %bm to %tm in the MakeIndex option.

Here is what I did:
Go to build > Define Output Profiles (Alt+F7)
Change %bm to %tm in the MakeIndex option.
Probably same thing needs to happen with Bibtex (if problem persists).


Edit:
I am really glad that you are finding it useful. Happy Texing!


Saturday, November 27, 2010

Entropy Plot for a fair coin toss

Entropy Plot for a fair coin toss

(Yes png as pdflatex does not take eps or pdf format.)
...

clear all
close all
p = 0.0:0.0001:1
entropy = -(p.*log2(p))-((1-p).*log2(1-p)); % in bits try logp to see in nats
figure;
h = plot(p,entropy);
axis tight;
mypretty(h,'Probability','Entropy (bits)','Entropy versus probability for a coin toss')
set(gca, 'LooseInset', [0,0,0,0]);
saveas(h, 'entropy_parabola.png')

Friday, November 26, 2010

Getting rid of un-necessary white spaces in matlab figures

Matlab creates a huge white space around the picture when we do "saveas figure".

There is workaround:

 http://tipstrickshowtos.blogspot.com/2010/08/how-to-get-rid-of-white-margin-in.html
OR
set(gca, 'LooseInset', [0,0,0,0]);

Thursday, November 25, 2010

Matlab codes in Latex

Use the package (mcode.sty) from:
http://www.mathworks.com/matlabcentral/fileexchange/8015-m-code-latex-package
add:
\usepackage[options]{mcode}
in the "header"
follow:
http://my.opera.com/locksley90/blog/2008/02/25/how-to-include-matlab-source-code-in-a-latex-document

Here is what I did:

This creates a box, pushes everything inside the box (ugly though) and forces next item to new page
\lstinputlisting[label=lst:run_main,breaklines=true, caption={\mcode{run_main.m}}]{G:/academy/random-s-circle/jan14-refine/run_main.m}
\clearpage 

Wednesday, November 24, 2010

Playing with saved figure to decorate

playing with the saved figure
uiopen('SSF_5MOG.fig',1)

% uiopen('intensity_compared5MoG.fig',1)
handle = set(gca);
axis([29 71 29 71])
line([29 71], [50 50],'LineWidth',1,'Color','yellow')
line([50 50],[29 71],'LineWidth',1,'Color','yellow')
handle = gcf;
% dummy = mypretty(handle,'Position of the center of the sensor (cm)','Intensity (LEGO Units)',... 'Intensity measurement compared for 5 MoG')
% hh = legend('prediction1','prediction2','prediction3','prediction4','data1','data2','data3','data4',2);
% dummy = set(gca,'LineWidth',2,'MarkerSize',8)

cd 'ssf-figures'
% saveas('')
% filename = 'intensity_compared5MoG'
filename = 'SSF_5MOG_zoomed'

% pause
saveas(handle,filename,'fig')
saveas(handle,filename,'png')
% close
% cd 'ssf-run-home'