how to set a plot to start at zero
19 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
採用された回答
その他の回答 (1 件)
Jan
2017 年 9 月 27 日
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 件のコメント
Jan
2017 年 9 月 27 日
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));
参考
カテゴリ
Help Center および File Exchange で Multirate Signal Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!