Assume you have a realization of a Galton-Watson process (a basic branching process). And you want to plot this realization. The default function in matlab (treeplot) doesn't display this well because of how it handles the depths of the nodes (it will not properly reflect the generation). A matlab user has written an updated function (treetrimplot) which can be found in this suite
https://www.mathworks.com/matlabcentral/fileexchange/2493-simulation-of-stochastic-processes
Additionally, you can the use of treetrimplot here
http://www2.math.uu.se/~ikaj/courses/matlab/rtrees.html
Thursday, May 18, 2017
Friday, September 12, 2014
Matlab export graphs, figures
1. I want to find a way to batch export figures ,e.g. if you want it so that every figure produced is outputted in black and white as a pdf file
*I think that there is an option to do this on the CFX.
2. I did find this:
http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig
*I think that there is an option to do this on the CFX.
2. I did find this:
http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig
Friday, July 19, 2013
bst File Which Handles Multiple Authors (reduces it to et al)
This bst file seems to handle the multiple author issue (listing the first three authors and then compacting the rest with et al).
http://www.biology.emory.edu/Antia/pjohnson/bst/mbe.bst
http://www.biology.emory.edu/Antia/pjohnson/bst/mbe.bst
Sunday, June 9, 2013
Matlab Output into latex table (Matlab to Latex Table)
This post comments on turning Matlab output into raw latex for inclusion in a latex table, for using \begin{tabular} \end{tabular}.
My preferred way to do this is to use latex.m to convert a Matlab matrix into latex format that can then be posted into tabular.
This is a common problem in simulation studies, where you use Matlab to summarize the results of a simulation study into a table.
I. Caveats regarding my solution:
1. There are probably fancier ways to do this now. I'm using Matlab2latex technology from about 2002. You can check on the central file exchange
2. Also, there might be a way to do this in base-Matlab. I got some file off of Central file exchange. I will note that sometimes a basic solution is very helpful because there are no extra bells/whistles and it is not hard to figure out the options of simple user supplied functions.
II. Other Posted Solutions:
1. http://pundit.pratt.duke.edu/wiki/MATLAB:LaTeX_Table_Writer
2. You can see more advanced ideas in the CFX
http://www.mathworks.com/matlabcentral/fileexchange/index?utf8=%E2%9C%93&term=latex+table
3. matrix2latex seems pretty good too.
III. Dependencies (what file exchange .m files am I using)
IV. My solution
1. use latex.m - This file will output a MATLAB numeric matrix in a format suitable to paste into a LaTeX tabular environment.
http://www.mathworks.com/matlabcentral/fileexchange/2832-latex
2. internal comment. see gmail FBlog with code. Also, see work from Screening paper.
My preferred way to do this is to use latex.m to convert a Matlab matrix into latex format that can then be posted into tabular.
This is a common problem in simulation studies, where you use Matlab to summarize the results of a simulation study into a table.
I. Caveats regarding my solution:
1. There are probably fancier ways to do this now. I'm using Matlab2latex technology from about 2002. You can check on the central file exchange
2. Also, there might be a way to do this in base-Matlab. I got some file off of Central file exchange. I will note that sometimes a basic solution is very helpful because there are no extra bells/whistles and it is not hard to figure out the options of simple user supplied functions.
II. Other Posted Solutions:
1. http://pundit.pratt.duke.edu/wiki/MATLAB:LaTeX_Table_Writer
2. You can see more advanced ideas in the CFX
http://www.mathworks.com/matlabcentral/fileexchange/index?utf8=%E2%9C%93&term=latex+table
3. matrix2latex seems pretty good too.
III. Dependencies (what file exchange .m files am I using)
IV. My solution
1. use latex.m - This file will output a MATLAB numeric matrix in a format suitable to paste into a LaTeX tabular environment.
http://www.mathworks.com/matlabcentral/fileexchange/2832-latex
2. internal comment. see gmail FBlog with code. Also, see work from Screening paper.
Sunday, June 10, 2012
Subscript, underscore in Latex
In the equation model, either will work fine. But for inline mathematics you notice a difference. Probalby the operator name isn't needed here, if \max is already defined.
$\max_i$
vs.
$\underset{i}{\operatorname{max}}$
$\max_i$
vs.
$\underset{i}{\operatorname{max}}$
Wednesday, May 23, 2012
Comment Command for Joint Editing
Idea is when we collaborate on a paper it is nice to have a method of leaving comments.
I. Solution write your own commands for each author to make a comment function: author1comment, author2comment.
preamble (need color, anything else?)
\usepackage{color}
commands:
%-----------------------
\def\boxit#1{\vbox{\hrule\hbox{\vrule\kern6pt \vbox{\kern6pt#1\kern6pt}\kern6pt\vrule}\hrule}}
\def\bfred#1{{\color{red}\bf#1}}
\def\bfblue#1{{\color{blue}\bf#1}}
\def\hlred#1{{\color{red}#1}}
\def\hlblue#1{{\color{blue}#1}}
\newcommand{\BHcomment}[1]{\vskip 2mm\boxit{\vskip 2mm{\color{red}\bf#1} {\color{black}\bf -- BH\vskip 2mm}}\vskip 2mm}
\newcommand{\DCcomment}[1]{\vskip 2mm\boxit{\vskip 2mm{\color{blue}\bf#1} {\color{black}\bf -- DC\vskip 2mm}}\vskip 2mm}
\newcommand{\RScomment}[1]{\vskip 2mm\boxit{\vskip 2mm{\color{green}\bf#1} {\color{black}\bf -- RS\vskip 2mm}}\vskip 2mm}
%-----------------------
usage in the body
\BHcomment{Bret writes his comment here. He emphasizes his point with a double exclamation point}
II. There are other solutions:
1. I think there is a track changes package in latex...but I also think I hate this package
2. Good old fashion, Jim gets green, Bob gets red, and Nancy gets blue
pre-amble \usepackage{color}
in text
\textcolor{red}{Here is a comment from Bob, He is *not* happy with this sentence}
I. Solution write your own commands for each author to make a comment function: author1comment, author2comment.
preamble (need color, anything else?)
\usepackage{color}
commands:
%-----------------------
\def\boxit#1{\vbox{\hrule\hbox{\vrule\kern6pt \vbox{\kern6pt#1\kern6pt}\kern6pt\vrule}\hrule}}
\def\bfred#1{{\color{red}\bf#1}}
\def\bfblue#1{{\color{blue}\bf#1}}
\def\hlred#1{{\color{red}#1}}
\def\hlblue#1{{\color{blue}#1}}
\newcommand{\BHcomment}[1]{\vskip 2mm\boxit{\vskip 2mm{\color{red}\bf#1} {\color{black}\bf -- BH\vskip 2mm}}\vskip 2mm}
\newcommand{\DCcomment}[1]{\vskip 2mm\boxit{\vskip 2mm{\color{blue}\bf#1} {\color{black}\bf -- DC\vskip 2mm}}\vskip 2mm}
\newcommand{\RScomment}[1]{\vskip 2mm\boxit{\vskip 2mm{\color{green}\bf#1} {\color{black}\bf -- RS\vskip 2mm}}\vskip 2mm}
%-----------------------
usage in the body
\BHcomment{Bret writes his comment here. He emphasizes his point with a double exclamation point}
II. There are other solutions:
1. I think there is a track changes package in latex...but I also think I hate this package
2. Good old fashion, Jim gets green, Bob gets red, and Nancy gets blue
pre-amble \usepackage{color}
in text
\textcolor{red}{Here is a comment from Bob, He is *not* happy with this sentence}
Tuesday, August 2, 2011
Matlab Simulation - General Discrete Distribution (multivarite)
1. one option is built in randsample with weighted option, you sample with certain weights.
There are CFX options
2. Discrete (multinomial) distribution sampler
http://www.mathworks.com/matlabcentral/fileexchange/25481-discrete-multinomial-distribution-sampler
3. randp
http://www.mathworks.com/matlabcentral/fileexchange/8891
There are CFX options
2. Discrete (multinomial) distribution sampler
http://www.mathworks.com/matlabcentral/fileexchange/25481-discrete-multinomial-distribution-sampler
3. randp
http://www.mathworks.com/matlabcentral/fileexchange/8891
Subscribe to:
Posts (Atom)