Highlights from
Mean square displacement analysis of particles trajectories


5.0 | 7 ratings Rate this file 77 Downloads (last 30 days) File Size: 26.9 KB File ID: #40692
image thumbnail

Mean square displacement analysis of particles trajectories



08 Mar 2013 (Updated )

A MATLAB class for the mean square displacement analysis of particle trajectories, with a tutorial.

| Watch this File

File Information

Mean square displacement (MSD) analysis is a technique commonly used in colloidal studies and biophysics to determine what is the mode of displacement of particles followed over time. In particular, it can help determine whether the particle is:
- freely diffusing;
- transported;
- bound and limited in its movement.
On top of this, it can also derive an estimate of the parameters of the movement, such as the diffusion coefficient.

@msdanalyzer is a MATLAB per-value class that helps performing this kind of analysis. The user provides several trajectories he measured, and the class can derive meaningful quantities for the determination of the movement modality.

@msdanalyzer can deal with tracks (particle trajectories) that do not start all at the same time, have different lengths, have missing detections (gaps: a particle fails to be detected in one or several frame then reappear), and do not have the same time sampling. As soon as you added your tracks to the class, everything is transparent. It offers facilities to plot and inspect the data, whether for individual particles, or on ensemble average quantities. It has several methods for correcting for drift, which is the main source of error in the analysis. Once corrected, the data can analyzed via the MSD curves or via the velocity autocorrelation. Automated fits of the MSD curves are included (but they require you have the curve fitting toolbox), allowing to derive the type of motion and its characteristics.

Included is a rather long tutorial with references, that will introduce you to the problem using numerical simulations, make you reproduce published results, and detail how the class work. Some basis of physics are required.


If you use this tool for your work, we kindly ask you to cite the following article for which it was created:

Nadine Tarantino, Jean-Yves Tinevez, Elizabeth Faris Crowell, Bertrand Boisson, Ricardo Henriques, Musa Mhlanga, Fabrice Agou, Alain Israƫl, and Emmanuel Laplantine. TNF and IL-1 exhibit distinct ubiquitin requirements for inducing NEMO-IKK supramolecular structures. J Cell Biol (2014) vol. 204 (2) pp. 231-45



Shaded Error Bar inspired this file.

Required Products Curve Fitting Toolbox
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (19)
23 Jul 2014 Vid Sustar


When using msdanalyser with xml file from trackmate I get a message:
Computing MSD of 44 tracks... 1/ 44Error using -
Matrix dimensions must agree.

Error in msdanalyzer/computeMSD (line 487)
delta = dr2 - mean_msd(index_in_all_delays);

How could this problem be solved?

Best regards,

Vid Sustar

16 Jul 2014 Jean-Yves Tinevez

Hi @Florent
It seems like an installation problem.
What does the 'which msdanalyzer' command says?
What does 'help msdanalyzer' says?

15 Jul 2014 Florent SPAGNI

Hi Jean-Yves,
I have a problem with a class type with your matlab files especially for the addall "ma = ma.addAll(tracks);".
I have this error message printed on the terminal: "No appropriate method, property, or field addAll for class msdanalyzer.".
Did you have this message in the past or have a solution to make it work?
Looking forward to reading to you very soon.
Best regards

14 Apr 2014 Gurthwin  
29 Jan 2014 Jean-Yves Tinevez

For the record: @Gurthwin sent me his track for me to investigate and I found them to be faulty. In some cases, the times of two consecutive detections were the same, so we had dT = 0 for them, which caused the msdanalyzer not to work properly.
Gurthwin is investigating the cause of the problem on his side, and I released a new version that checks that the tracks provided don't have this problem.

17 Jan 2014 Gurthwin

Hi Jean-Yves

I would be able to send you the data.


17 Jan 2014 Jean-Yves Tinevez

It looks like a touchy part of the code. I would need the data that generates the error to fix it. Can you contact me via email to send it?

16 Jan 2014 Gurthwin


This is really a wonderful tool for MSD analysis. I have attempted to submit some of my own tracks but I am greeted with the following error msg in the command window:
Computing MSD of 208 tracks... 3/ 208??? Error using ==> minus
Matrix dimensions must agree.

Error in ==> msdanalyzer>msdanalyzer.computeMSD at 470
delta = dr2 - mean_msd(index_in_all_delays);

I am pretty sure that the tracks are correct. What do you suggest I do?


29 Nov 2013 Jean-Yves Tinevez

@Fredik: Hi Fredik.
Actually no: this MATLAB class is a per-value class, which means that the updates are lost if you do not re-assign the changed object to a new reference.
So in fact you need to do something like that:
>> msd = msd.addTracks(...);
each time.

29 Nov 2013 Fredrik

Its a really nice little class that will be very useful I think. Especially nice to see such good documentation.

I have one problem Im hoping to get assistance with:
In principle everything that should update the properties throw out a new obj looking like it should (with eg added trajectories etc). But the object operated on did not save the updates. If I change the constructor to take trajectories it works and they persist as an object property but cannot be changed.

I am using Matlab 2012a if that should matter.
I dont have any other problems with similar classes that I use.

Would appreciate any input on this.


09 Nov 2013 Jean-Yves Tinevez

Hi. The tool is documented in the html tutorial you will find in the download. Just read it, and you will find the info you need.

08 Nov 2013 Sadiye Velioglu

I really want to use this msdanalyzer, but I could not find any documentation for usage. What type of file (trajectory) do I have to load for analysis? How can I load my trajectory?
Thanks a lot.

30 Oct 2013 Renee  
29 Aug 2013 Yilong Jia


09 Aug 2013 Yilong Jia  
08 Aug 2013 Nilesh Raval  
17 Jul 2013 Pete  
18 Jun 2013 Matt Baker

Great documentation. Standalone it is a very useful tutorial for understanding MSD computation, but additionally is very functional for diffusion coefficient computation across myriad situations.

23 Apr 2013 Harish Chandra  
29 Jan 2014

- Safeguards to ensure that the tracks provided are not erroneous.
- Links to the paper for which this work was created, now that it is out.

08 Jul 2014

Link to source on github, and to the online tutorial.

Contact us