I am working with gait data and have resampled 1 gait cycle (~120 data points) in to 100 using
[c,d] = size(RawData);
GC_Percent = resample (RawData,100,c);
This seems to work fine but when i plot the data it starts at 1% is there a way to change the output the the first value is plotted at 0 on the y axis?

 채택된 답변

KSSV
KSSV 2017년 9월 27일

0 개 추천

Subtract the minimum value (1%) from the data and then plot....

댓글 수: 2

WellsJ
WellsJ 2017년 9월 27일
apologies if i've misunderstood but that has shifted the data down to the x axis (obviously) i'm looking to shift it left on to the y axis.
Thank you
KSSV
KSSV 2017년 9월 27일
Try subtracting the minimum y value from y data.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2017년 9월 27일

0 개 추천

The output in the plot does not depend on the Y values, but on the provided x values:
y = rand(10, 10);
subplot(1,2,1);
plot(y)
subplot(1,2,2)
plot(0:9, y)
You posted the code for creating y, but the actual problem appears in the command for plotting, which you did not show.
By the way: resample applied an "antialiasing FIR lowpass filter". It is questionable if tis is really wanted for the analysis of the motion. I prefer a linear interpolation and have written for the same problem: FEX: ScaleTime
Yi = ScaleTime(Y, 100)
Are you sure that you want 100 time steps? Usually 101 steps are used in motion analysis to represent 100 intervals of 1%.

댓글 수: 4

WellsJ
WellsJ 2017년 9월 27일
Thank you this is actually the "step" i used (can't beat a gait pun). And yes upon adjusting for the offset on the x axis i changed it to 101 steps.
in regards to your other point about the use of
resample
I had initially tried to use interp1 but i never managed to get the syntax correct. If you have the opportunity i'd be really grateful for any advice.
Thank you
I've posted a link to the code already, which solves the problem much faster than interp1. But if you prefer this function:
sY = size(Y, 1);
Yi = interp1(1:sY, Y, linspace(1, sY, 101));
husnir nasyuha
husnir nasyuha 2019년 3월 27일
Hi, may I know what is Y in this code refer to?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Axes Appearance에 대해 자세히 알아보기

질문:

2017년 9월 27일

댓글:

2019년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by