convert angle over time to rotation speed
Show older comments
Hello, I am new to MATLAB and numerical computational software in general. I am struggling with what I'm sure is a simple problem, but can't seem to find a solution.
I get angle-Information over the Time back from a Resolver(Position Detection from a Motor) in a array. All values between 0 and 360 degree. When I plot this it looks like "sawtooth function" or "triangular function"(German:"Sägezahn-Funktion" or "Dreiecksfunktion"). I want to calculate roations per Minute. The datapoints are always taken after the same time(samplingtime[16kHz]). On paper no Problem and I got a idea how it can work, but got problems to do it in matlab. One big problem for me is how i can handle the edges of the triangle. I tried to do it on that way.
%if true%ignore the if and the end
velo=diff(PositionValue)*16000;
w=velo/(2*pi);%take the angular speed to rotations per second
n=w*60;%rotations per minute
%end%
Answers (1)
David Goodmanson
on 2 Nov 2016
Edited: David Goodmanson
on 2 Nov 2016
1 vote
Hello Bas, Take a look at the 'unwrap' function, which will take out the discontinuous jumps and give you a smooth function (with a much larger angular range) that you can differentiate. unwrap only works automatically in radians, though, so if your angles are in degrees you will have to convert to radians, use unwrap and convert back. Or you could try unwrap with the 'cutoff' option set to 180 and see how well that works.
1 Comment
BastiON36
on 2 Nov 2016
Categories
Find more on Simulink in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!