Interpolation of values between the beginning and end of crank rotation

1 visualización (últimos 30 días)
Nithin
Nithin el 28 de Nov. de 2017
Respondida: Star Strider el 28 de Nov. de 2017
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

Respuestas (1)

Star Strider
Star Strider el 28 de Nov. de 2017
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.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by