Interpolation of values between the beginning and end of crank rotation
조회 수: 3 (최근 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!