%%MSD executive
%<<<<<<<<<<<<<<<<<<< exp_002 <<<<<<<<<<<<<<<<
clc;clear all;
nr_of_exp='exp_074';%<<<<---------Set it in 18 and 36 line
letter='X';
% INSERT RIGHT VALUES
% Time scale % Distance scale [pix/um]
skala_pix=5.61;
% LOAD TABELS
filename1=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\CENTR.mat'];%<<<<<<
filename2=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\ORIENT.mat'];%<<<<<<
directory2=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\'];%<<<<<<
% Run function
skala_czasu=16/100;%Time scale
funkcje = [letter,':\pnakiel\__MATLAB_SCRIPTS_AND_PROGRAMS\FIBER_Brownian_motion_MSD_angle\MATLAB_SCRIPTS\PN'];
cd(funkcje)
MSDandDiff(skala_czasu,skala_pix,filename1,filename2,directory2)




%% Figure MSD
clc;clear all; % You need to clear all because strange things happends with images
nr_of_exp='exp_074';%<<<,--------------------
letter='X';
skala_czasu=16/100;%Time scale
filename11=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\MSD.mat'];
filename22=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\MSD2.mat'];
filename33=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\MSD3.mat'];
filename_fig1=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\MSD_fiber_',nr_of_exp,'.tif'];
D_x='D_x = 0.0292 {mu}m^2/s';%<<<<<-----Put calculated values
D_y='D_y = 0.0875 {mu}m^2/s';%<<<<<-----Put calculated values
D_t='D_Theta = 0.0002 rad^2/s';%<<<<<-----Put calculated values
axis1=[0.1 1000 0.00001 1000];
%Legend position
pion=0.15;%
poz1=8.0;%position x
poz2=4.0;%pos y
poz3=2.0;%pos teta
funkcje = [letter,':\pnakiel\__MATLAB_SCRIPTS_AND_PROGRAMS\FIBER_Brownian_motion_MSD_angle\MATLAB_SCRIPTS\PN'];
cd(funkcje)
figureMSD(filename11,filename22,filename33,filename_fig1,skala_czasu,D_x,D_y,D_t,axis1,pion,poz1,poz2,poz3)







%% Figure angle
clc;clear all; % You need to clear all because strange things happends with images
nr_of_exp='exp_074';%<<<<-----------------
letter='X';
skala_czasu=16/100;

filename111=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\ORIENT.mat'];
filename_fig22=[letter,':\phejduk\fibers\',nr_of_exp,'\result_out\ANGLE_fiber_',nr_of_exp,'.tif'];
funkcje = [letter,':\pnakiel\__MATLAB_SCRIPTS_AND_PROGRAMS\FIBER_Brownian_motion_MSD_angle\MATLAB_SCRIPTS\PN'];
cd(funkcje)
figureANGLE(filename111,filename_fig22,skala_czasu)