literate-dotfiles/matlab.org

165 lines
4.5 KiB
Org Mode
Raw Normal View History

2020-01-12 17:40:59 +01:00
#+TITLE: Matlab Configuration
2021-01-01 20:12:34 +01:00
#+SETUPFILE: ./setup/org-setup-file.org
2020-01-12 17:43:30 +01:00
#+PROPERTY: header-args:matlab :mkdir yes
2020-01-12 17:40:59 +01:00
#+PROPERTY: header-args:matlab+ :exports code
#+PROPERTY: header-args:matlab+ :eval no-export
#+PROPERTY: header-args:matlab+ :results silent
* Startup
:PROPERTIES:
2020-01-12 17:43:30 +01:00
:HEADER-ARGS:matlab+: :tangle ~/Documents/MATLAB/startup.m
2020-01-12 17:40:59 +01:00
:END:
** Setup LaTeX as a default interpreter
#+begin_src matlab
set(groot, 'DefaultTextInterpreter', 'LaTeX');
set(groot, 'DefaultAxesTickLabelInterpreter', 'LaTeX');
set(groot, 'DefaultAxesFontName', 'LaTeX');
set(groot, 'DefaultLegendInterpreter', 'LaTeX');
2020-01-12 17:40:59 +01:00
#+end_src
** Default Line Width
#+begin_src matlab
set(groot, 'DefaultLineLineWidth', 1.5);
set(groot, 'DefaultAxesLineWidth', 0.5);
2020-01-12 17:40:59 +01:00
#+end_src
** Default grids on all axis
#+begin_src matlab
set(groot, 'DefaultAxesXGrid','on');
set(groot, 'DefaultAxesYGrid','on');
set(groot, 'DefaultAxesZGrid','on');
2020-01-12 17:40:59 +01:00
#+end_src
** Default Font Size
#+begin_src matlab
set(groot, 'DefaultTextFontUnits', 'points');
set(groot, 'DefaultTextFontSize', 10);
set(groot, 'DefaultAxesFontUnits', 'points');
set(groot, 'DefaultAxesFontSize', 10);
set(groot, 'DefaultUicontrolFontSize', 10);
2020-01-12 17:40:59 +01:00
#+end_src
** Default Fonts
#+begin_src matlab
set(groot, 'DefaultAxesFontName', 'Helvetica');
set(groot, 'DefaultTextFontName', 'Helvetica');
2020-01-12 17:40:59 +01:00
#+end_src
** Make figures into a Box
#+begin_src matlab
set(groot, 'DefaultAxesBox', 'on');
2020-01-12 17:40:59 +01:00
#+end_src
** Default Colors
#+begin_src matlab
set(groot, 'DefaultAxesColor', 'w');
set(groot, 'DefaultAxesXColor', 'k');
set(groot, 'DefaultAxesYColor', 'k');
2020-01-12 17:40:59 +01:00
set(groot, 'DefaultFigureColor', 'w');
2020-01-12 17:40:59 +01:00
#+end_src
** Default Plot Colors
#+begin_src matlab
c1 = [ 0 0.4470 0.7410]; % Blue
c2 = [0.8500 0.3250 0.0980]; % Orange
c3 = [0.9290 0.6940 0.1250]; % Yellow
c4 = [0.4940 0.1840 0.5560]; % Purple
c5 = [0.4660 0.6740 0.1880]; % Green
c6 = [0.3010 0.7450 0.9330]; % Light Blue
c7 = [0.6350 0.0780 0.1840]; % Red
2020-01-12 17:40:59 +01:00
set(groot, 'defaultAxesColorOrder', [c1; c2; c3; c4; c5; c6; c7])
2020-01-12 17:40:59 +01:00
#+end_src
** Figure paper and window style
#+begin_src matlab
set(groot, 'DefaultFigurePaperType', 'A4');
set(groot, 'DefaultFigureWindowStyle', 'normal');
2020-01-12 17:40:59 +01:00
#+end_src
** Set the display format
#+begin_src matlab
format compact;
format long g;
2020-01-12 17:40:59 +01:00
#+end_src
** Home Path
#+begin_src matlab
toolboxes_path = '~/Cloud/thesis/matlab/toolboxes/';
2020-01-12 17:40:59 +01:00
#+end_src
** Add to path
2020-11-03 16:27:35 +01:00
Provides =vecfig3= for FRF fitting ([[https://www.sintef.no/projectweb/vectorfitting/downloads/][link]]).
#+begin_src matlab
addpath([toolboxes_path 'matrix_fitting_toolbox_1'])
2020-11-03 16:27:35 +01:00
#+end_src
Apply and save color schemes in MATLAB with ease ([[https://github.com/scottclowe/matlab-schemer][link]]).
#+begin_src matlab
addpath([toolboxes_path 'matlab-schemer'])
2020-11-03 16:27:35 +01:00
#+end_src
Converts MATLAB figures to TikZ ([[https://github.com/matlab2tikz/matlab2tikz][link]]).
#+begin_src matlab
addpath([toolboxes_path 'matlab2tikz/src'])
2020-11-03 16:27:35 +01:00
#+end_src
MATLAB toolbox for exporting publication quality figures ([[https://github.com/altmany/export_fig][link]]).
#+begin_src matlab
addpath([toolboxes_path 'export_fig'])
2020-11-03 16:27:35 +01:00
#+end_src
MATLAB source code formatter, beautifier ([[https://github.com/davidvarga/MBeautifier][link]]).
#+begin_src matlab
addpath([toolboxes_path 'MBeautifier'])
2020-11-03 16:27:35 +01:00
#+end_src
Toolbox for Convex Programming ([[http://cvxr.com/cvx/][link]]).
#+begin_src matlab
addpath([toolboxes_path 'CVX'])
2020-11-03 16:27:35 +01:00
#+end_src
Useful functions to use with =orgmode= ([[https://github.com/tdehaeze/Org-Mode-Matlab][link]]).
2020-01-12 17:40:59 +01:00
#+begin_src matlab
addpath([toolboxes_path 'Org-Mode-Toolbox/src'])
2020-11-03 16:27:35 +01:00
#+end_src
Some useful function ([[https://github.com/tdehaeze/matlab_useful_functions][link]]).
#+begin_src matlab
addpath([toolboxes_path 'matlab_useful_functions/src'])
2020-11-03 16:27:35 +01:00
#+end_src
H-Infinity Toolbox ([[https://github.com/tdehaeze/hinf-toolbox][link]]).
#+begin_src matlab
% addpath([toolboxes_path 'Hinf-Toolbox/src'])
2020-11-03 16:27:35 +01:00
#+end_src
Toolbox to work with Finite Element Models ([[https://github.com/tdehaeze/fem_matlab_toolbox][link]]).
#+begin_src matlab
addpath([toolboxes_path 'fem_toolbox/src'])
2020-01-12 17:40:59 +01:00
#+end_src
2021-01-01 20:12:34 +01:00
Toolbox to work with fractional order models ([[https://github.com/extall/fomcon-matlab][link]]).
#+begin_src matlab
addpath(genpath([toolboxes_path 'fomcon-matlab']))
2021-01-01 20:12:34 +01:00
#+end_src
2020-01-12 17:40:59 +01:00
** Clear
#+begin_src matlab
clear;
2020-01-12 17:40:59 +01:00
#+end_src
* Setup
:PROPERTIES:
2020-01-12 17:43:30 +01:00
:HEADER-ARGS:matlab+: :tangle ~/Documents/MATLAB/setup.m
2020-01-12 17:40:59 +01:00
:END:
2020-11-03 16:27:35 +01:00
This script should be run once after Matlab is installed.
Import a nice color scheme.
2020-01-12 17:40:59 +01:00
#+begin_src matlab
schemer_import('~/Cloud/thesis/matlab/toolboxes/Add-Ons/matlab-schemer/schemes/monokai.prf');
2020-01-12 17:40:59 +01:00
#+end_src