computing second derivative from txt/csv file based on existing excel algorithm
6 views (last 30 days)
Show older comments
Hi everyone,
I am new to Matlab. I have trouble finding anwsers to my problem. I decided to try Matlab for faster computing of my problem. I am working on my PhD from biomechanics as physiotherapist. I haave captured data from c3d files and by mokka software it can be exported for selected markers to txt file. In excel, each time I need to paste exported data to excel algoritm which I attached in a file here. Then I need to find max velocity of each move (three kicks captured for one file). It is time consuming in excel. i need to do it about 400 times. Each time it gave me only 3 results and takes around 10-15 minutes to do it. I had idea of making macro in Matlab. I want to write an alogrithm for skipping some steps. I want to import file, compute second derivative (t time, xyz -marker positions), and then find max values from 3 sectors -rows 0-700, 701-1400, 1401-2100. I cannot find commands for computing this in a same manner as it is in this excel file. Can you at least guide me how do I compute columns values row to corresponding row?
1 Comment
dpb
on 15 Apr 2019
"how do I compute columns values row to corresponding row?"
Can you explain what, precisely, you mean by the above?
A short example with inputs and expected outputs and how the output follows from the input would be best...
Accepted Answer
dpb
on 16 Apr 2019
Edited: dpb
on 16 Apr 2019
Here's perfect example why Matlab excels over Excel... :)
txyz=importdata('B0264_dollyo_air_P_T01 rtoe.txt',',',8); % read the text file
txyz=txyz.data; % all data in array time,x,y,z
dxyz=diff(txyz); % first differences of all columns
vxyz=dxyz(:,2:end)./dxyz(:,1)/1000; % compute velocity components
v=sqrt(sum(vxyz.^2,2)); % and the total velocity
One doesn't need to keep all the intermediary variables unless there's other need for them; kept here so can look at them and see how matches up.
The text file and the Excel file aren't the same data and the Excel file has the European "," for the decimal point so it's hard to read here in the US w/o other machinations so couldn't directly illustrate it does give identical result...
BTW, despite the Q? title, there's only a first derivative, not second...if need the second, you just "rinse and repeat" the above or use the second, optional argument to diff to compute it directly if don't need the first but this was just a step along the way...
More Answers (1)
Dariusz Mosler
on 15 Apr 2019
12 Comments
dpb
on 19 Apr 2019
I'm not sure on the non-US licensing arrangements, sorry.
I'd think Mathworks US would answer an enquiry e-mail though and be eager to know of any sales associates that aren't responsive so they could take action.
The closest thing I know of altho I've never actually used it is Octave -- as said, I don't know about some of the more esoteric features in toolboxes, but the base product is pretty-much same functionality/syntax.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!