Program that takes input from excel file and calculate distance and msd for each point!

5 views (last 30 days)
I am assigned to write a code which takes input from an excel sheet containing observation no., x coordinate, y coordinate and time tag and calculate the msd (mean square displacement) for the entire data. I got the basic idea that I need to get some 'for' loops going one of which will be calculating the distance between two consecutive points. I'm new to MatLab so I'm quite unable to figure out how to write the code. It'll be really helpful for y'all if you can tell me the best way to counter this problem!
Thanks to all of you!

Answers (1)

Cris LaPierre
Cris LaPierre on 27 Oct 2019
I'd recommend you start by learning the fundamentals of MATLAB. For this, I'd suggest completing MATLAB Onramp. It's an interactive, self-paced course that can complete in a few hours.
You might not have to loop through each point. If the calculation is all the same for each point (and it sounds like it should be), MATLAB can perform the calcualtion on all elements in the array at the same time.
I'd suggest you look into using readtable to get your data into MATLAB. Then use what you learn in Onramp to code up your equation.

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!