computing second derivative from txt/csv file based on existing excel algorithm
Afficher commentaires plus anciens
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 commentaire
dpb
le 15 Avr 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...
Réponse acceptée
Plus de réponses (1)
Dariusz Mosler
le 15 Avr 2019
0 votes
12 commentaires
Dariusz Mosler
le 16 Avr 2019
There's a job for findpeaks
>> [pks,locs]=findpeaks(v,'minpeakheight',6)
pks =
9.5790
10.8706
12.2447
locs =
653
1525
2452
>>
See
doc findpeaks
for details...there are numerous options to help find the ones of interest. I just took the easy route out of looking at the plot and picking a threshold number.
As for multiple files, just put the code in a loop and read each file sequentially...there are any number of threads about processing mutiple files..
ADDENDUM
And, of course, you could string all the various velocity measurements together into a single array or file while doing so for further analyses later on and not have to reprocess the raw data again...if measurements aren't same length, either use cell array or augment shorter with NaN to create array of double...
Dariusz Mosler
le 17 Avr 2019
Modifié(e) : Dariusz Mosler
le 17 Avr 2019
dpb
le 17 Avr 2019
It's a hobby; there are many on the Answers forum that spend far more time than I but all have a fondness for Matlab itself plus enjoy both the challenge some of the Q?s posed as well as just tutoring newcomers into effective use of the tool--it's enough different in concept as compared to procedural languages that aren't vectorized in their operations or the spreadsheet paradigm it takes some time to understand just what it is good for and how to take advantage of it.
For the multiple files, I recommend to first look at the dir solution under the help topic Import or Export a Sequence of Files -- it's not the easiest topic to find altho one of the most oft-needed functionalities -- there's link under the Standard File Formats topic at the Data Import and Export higher level topic.
With that you simply iterate through the returned list of files retrieving the name of each in sequence from the dir structure name field...it's a "piece o' cake!" that way as long as you can make a suitable wildcard expression to return the wanted list of filenames.
Dariusz Mosler
le 17 Avr 2019
dpb
le 17 Avr 2019
ML is definitely expensive outside the student license which sounds like you wouldn't qualify for, unfortunately.
There is the open "workalike" Octave for at least the base functionality; I do not know what all of the toolbox functionality is available (findpeaks is in the ML Signal Processing TB, not the base product).
If I follow your description, it would be pretty easy to group the data by individual incorporating all records for that person in one file...again, if it is simply this velocity that is the end result, then just saving it would be a big reduction in futher processing as long as don't need to do anything with individual velocity components for directional analysis, say.
Good luck...I'm an old fogey back on the family farm for some 20 years now after 30+ yr in consulting gig so my energy level tends to run low pretty early in the evening any more, too!
dpb
le 17 Avr 2019
[DM Answer moved to comment... dpb]
If this computing is accessable via home license I will buy it. Commercial or academic is out of option for now, although I do not understand differences in licenses.
Farm you say? I imagine programmed machines on your field with your expertise:D
dpb
le 17 Avr 2019
Indeed the two major changes since I "left for the big city" back in late '60s are twofold--
- Size of operations and equipment -- our operation that was upper quartile back then is now probably in bottom 20% by acreage farmed. What I did with a four-row lister at 3-4 mph planting is now 16-24 row planter at probably 6+ mph
- Technology -- GPS and the microprocessor has indeed revolutionized everything from self-guidance systems on the macro level to planters that meter and place individual seeds at nominal spacing in the row to achieve target planting density and dispense starter fertilizer and fungicides, etc., at the same time to harvest monitors that display in real time yield which then can be related back to the soil type and inputs for optimizing net return for making decisions going forward.
Even the most progressive had no way to collect the necessary data what more make use of it back then...
dpb
le 17 Avr 2019
You'll want to talk to Mathworks sales support on options available -- I think there is a new "home user" or somesuch category now that didn't used to be for such cases but I'm not fully aware of all the options, sorry.
Dariusz Mosler
le 18 Avr 2019
dpb
le 19 Avr 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.
Dariusz Mosler
le 19 Avr 2019
Catégories
En savoir plus sur Historical Contests dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!