Return to Teaching materials

Code Examples

A few examples of Matlab codes (with comments) used for the “Matlab methods” group at the Centre for BrainHealth, Computational Psychiatry Unit (

Virtual fly test tube

In an ongoing collaboration with dr Frank Hirth‘s lab, a couple of months ago I have been invited to generate the code for a simulated insect navigating a virtual 2-dimensional world. This investigation aimed at testing whether a recently developed neural model of the central complex in insects (i.e. see related work here and here) could …

Randomly sampled TTest comparison

The following code has been used to compare couples of vectors in a given structure composed of 4×12 cells which result from simulated results of 4×12 model genotypes (download archive here). Most vectors have a similar dimension (175), but some differ, requiring a multiple random comparison by permutation. The final distribution of the p-values (reported in the …

Continuous error band in Matlab

I was looking for a plot function in Matlab that could create error “bands” with a continuous filled plot for the standard error, highlighting the mean. In the end I decided to create the function I needed so that I could have the parameters I wanted: namely colours and transparency. Here an example of how to …

Insert math as
Additional settings
Formula color
Text color
Type math using LaTeX
Nothing to preview
%d bloggers like this: