Radians to RPM with diff(..) function
조회 수: 6 (최근 30일)
이전 댓글 표시
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/659740/image.png)
I can not figure out how to do this the "smart way" by using Matlabs diff().
Can anyone help me?
댓글 수: 3
채택된 답변
Chunru
2021년 6월 21일
rpmArray = (radiansArray/(2*pi));
minutesArray = timeArray/60;
slopeArray = gradient(rpmArray)./gradient(minuteArray);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!