computing second derivative from txt/csv file based on existing excel algorithm

4 ビュー (過去 30 日間)
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 件のコメント
dpb
dpb 2019 年 4 月 15 日
"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...

サインインしてコメントする。

採用された回答

dpb
dpb 2019 年 4 月 16 日
編集済み: dpb 2019 年 4 月 16 日
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...
  1 件のコメント
Dariusz Mosler
Dariusz Mosler 2019 年 4 月 16 日
Thank you very much! This will help me a lot.
I propably made a mistake translating math terms.
Best wishes for you

サインインしてコメントする。

その他の回答 (1 件)

Dariusz Mosler
Dariusz Mosler 2019 年 4 月 15 日
Please see the excel file. There is T value for time X, Y, Z for position in time for markers. =(B4/1000-B3/1000)/($A4-$A3) for example (x4/1000-x3/100)/(t4-t3). I do not know how to adress colums and values as it is in excel. If I state in matlab t2 = varx(:, 2) to have x value column and the same matter t column, what should I write to compute the same pattern as in excel? I am providing sample of txt file.
  12 件のコメント
dpb
dpb 2019 年 4 月 19 日
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.
Dariusz Mosler
Dariusz Mosler 2019 年 4 月 19 日
Thank you very much for recommending Octave. Code runs after I added signal package. It may be sufficient for now and further learning

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeJust for fun についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by