Interpolation of values between the beginning and end of crank rotation
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I am trying to interpolate values during rotation of a crank. I have issue at the transitions from 355-0.5 angle, as the interpolated values in between the (1s-2s) interval decreases, when the cycle should naturally end at 360 degree and new cycle begins with 0. How can I set it up, such that t_tointerpolate at 1.5s = 360 or around and then t_original at 2s = 0.5;
I tried to find the indices of columns where these transitions happen, but no luck.
t_original = [0, 1, 2, 3, 4];
t_tointerpolate = [0.5,1.5, 2.5, 3.5];
angle = [350 , 355, 0.5, 2, 3] ;
for i =1:length(angle)-1
b = find (angle(i+1)<angle(i))
end
0 件のコメント
回答 (1 件)
Star Strider
2017 年 11 月 28 日
I would use the interp1 funciton.
Try this:
t_original = [0, 1, 2, 3, 4];
angle = [350 , 355, 0.5, 2, 3];
t_tointerpolate = [0.5,1.5, 2.5, 3.5];
new_angle = interp1(t_original, angle, t_tointerpolate, 'linear', 'extrap');
See the documentation for interp1 for a full description of its abilities.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!