MATLAB Answers

Can someone help me solve this problem (Array indices must be positive integers or logical values)

1 view (last 30 days)
Koon Hang Chu
Koon Hang Chu on 28 Mar 2019
Commented: Koon Hang Chu on 28 Mar 2019
I tried to get the answer from this equation: sum(abs(diff(CPap)))*freq/length(CPap)
I assumed I need to tell matlab what CPap, freq and length represent right?
So I typed in CPap = 0.3, freq = 100 an length = 10
But when i hit enter, this sentence showed, can someone tell me what am i doing wrong here?
Many thanks!!!

Answers (1)

Arvind Sathyanarayanan
Arvind Sathyanarayanan on 28 Mar 2019
The issue is with length(CPap). You're trying to divide sum(abs(diff(CPap)))*freq by length(0.3), in your case length is not an array. If it was an array, then indices must be positive integers
  7 Comments
Koon Hang Chu
Koon Hang Chu on 28 Mar 2019
This is the equation I found in published research article:I try to find the mean velocity
Mean Velocity in AP direction =sum(abs(diff(CPap)))*freq/length(CPap)
This is my research dissertation and I 'll try to explain what I'm trying to find here, please bare with me if it gets too boring:
Basically I put participants on a forceplate with a series of standing tasks and measure their centre of pressure in ax and ay direction in 10 seconds (Anterio-posterior and Medio-lateral direction, as shown in graph). This is known as postural sway (how much sway we have during those tasks). Now within the COP, there are other parameters that can be calculated like the mean velocity (the one I'm trying to calculate). I got a column of data numbers (COP) within that 10 seconds duration so I calculated the average of each direction (AP and ML) and came up with two numbers. And I think COP is a vector, so am I doing it wrong by caculating the average from all data?fp_type6.jpg

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!