Useful Gibberish

Posts tagged ‘matlab’

Awesome posts from all over the blogs in this week (week 34/2014)

I started to collect awesome post from other blog to share in my personal blog, they’re about life tips, ideas, design inspirations…

1. Taking note techniques from Japanese people:

http://blog.highfivehq.com/posts/a-little-known-hack-from-japan-to-get-your-notebook-organized

This is one of the coolest technique to take note that I’ve ever read. Hat tip to Japanese people.

2. Finding local peak in a curve with Matlab:

Data post-processing is very important in your research, the original author knew that and shared you this matlab code

http://blogs.mathworks.com/pick/2009/11/13/this-peaks-my-interest/

3. Sharpen your photo using High pass filter in Photoshop:

This is a very simple but powerful technique to sharpen your photos. Work like a charm!

http://news.dphotographer.co.uk/tutorials/creative-use-of-the-high-pass-filter-in-photoshop-to-sharpen-your-images/

Useful MatLab code for plotting

Increase all text size:
set(gca,'FontSize',14)
figureHandle = gcf;
set(findall(figureHandle,'type','text'),'fontSize',14)

Labelling the plot:
xlabel('$\alpha_\varepsilon$ - direction of strain probe $(\circ)$','interpreter','latex');
ylabel('Second order work $W_2$ and $W_2^{\mu}$ (J)','interpreter','latex');

Hatch region:
harea = area([140 140 150 150 140],[-0.05 0.3 0.3 -0.05 -0.05],3 );
child=get(harea,'Children')
set( harea, 'FaceColor', 'm')
alpha('texture')

Increase text size for plotyy function

[ax h1 h2]=plotyy(e22,ev,e22,q)
set(ax,'FontSize',14)

Subplot

%subplot of (w2 normalized), (compare), (new,lostcontact), (total contact)
subplot(2,2,1);
polar(degtorad(alpha),w2normal,'r--*');
title('Normalized $W_2$ at $\eta=0.92$','interpreter','latex')

subplot(2,2,2);
plot(alpha,ntotal,'b--*');
xlim([0 350]);
xlabel('Angle of stress probe - $\alpha_\sigma$','interpreter','latex');
ylabel('Total contacts - $N_c$','interpreter','latex');
grid on;
title('Total contacts numbers $N_c$ at $\alpha_\sigma$','interpreter','latex')

subplot(2,2,3);
plot(alpha,nlost,'r--o',alpha,nnew,'b--*');
xlim([0 350]);
xlabel('Angle of stress probe - $\alpha_\sigma$','interpreter','latex');
ylabel('New ($N_{new}$) and lost ($N_{lost}$) contacts','interpreter','latex');
legend('N_{lost}','N_{New}');
grid on;
title('Lost contacts and new contacts during the directional research')

subplot(2,2,4);
plot(alpha,w2macro,'b--o',alpha,w2micro,'r--*');
legend('W_2 macro','W_2 micro');
xlabel('Angle of stress probe - $\alpha_\sigma$','interpreter','latex');
ylabel('Second order work (J)','interpreter','latex');
xlim([0 350]);
grid on;
title('Comparison $W_{2}macro$ and $W_{2}micro$','interpreter','latex')

Adding point to Matlab plot

Here is the code to plot a data point to a 2D diagram.

plot(x,y) %plot the line
yi=interp1(x,y,a)
% a is a real number of the
% x-axis value of the data point
hold on
plot(a,yi,'*')

For example:

x=[0:0.01:1];
y=[0:10:1000];
plot(x,y);
% Now add a data point with x=0.25
yi=interp1(x,y,0.25);
hold on;
plot(0.25,yi,'*')

Install Matlab problems and resolve them (Linux Version)

1. ISO file:

When you don’t have the CD, you might have the download version of it, then you can extract it to a folder. Then you will have a folder of files, what we will do is the install sh script.

sudo chmod +x install

Then

sudo sh install

2. Java problems:

I got the answer (very clear and easy to follow so I decided to spread his help) from

http://tylau0.blogspot.fr/2011/12/matlab-linux-install-error.html

From the install package, cd to sys/java/jre/xxx/jre/bin directory. (xxx could be glnx86 or glnxa64 or something similar)
chmod a+x *
Execute the install command once again. You should be all set.

 

3. Still java problem:

Even if you have fixed the authorizing problem, there’s still be there another one, here’s what I got in the comment section from the link above:

And if you see the following error:
———————-
/tmp/mathworks_26521/sys/java/jre/glnxa64/jre/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
———————-
apt get install openjdk-7-jre and then run the install script with the -javadir option as /usr/lib/jvm/java-7-openjdk-amd64/jre
See http://askubuntu.com/questions/151826/how-to-fix-java-problem-installing-matlab-2012a-64-bit-in-ubuntu-12-04-64-bit

 

That’s that. Now I have Matlab on my Ubuntu 12.04 64bit. Yuhoo, time to start serious again.

Tag Cloud

%d bloggers like this: