Radians to RPM with diff(..) function
显示 更早的评论
Hi...
I need to finde the RPM from a vector of radians and a vector of seconds (time).
I can do this manually by doing this:
rpmArray = (radiansArray/(2*pi));
minutesArray = timeArray/60;
slopeArray = [];
for counter = 1:length(minutesArray)
if counter < length(minutesArray)
x1 = minutesArray(counter);
x2 = minutesArray(counter + 1);
y1 = rpmArray(counter);
y2 = rpmArray(counter + 1);
slopeArray(counter) = (y2-y1)/(x2-x1);
end
end
slopeArray(end + 1) = slopeArray(end); % Fill in the missing entry

I can not figure out how to do this the "smart way" by using Matlabs diff().
Can anyone help me?
3 个评论
Walter Roberson
2021-6-21
Perhaps use gradient() ?
Kenneth Metzsch
2021-6-21
Stephen23
2021-6-21
"It assumes spacing is 1."
Did you look at the h/hx/hy inputs?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!