필터 지우기
필터 지우기

How to change units of a value?

조회 수: 1 (최근 30일)
np
np 2016년 6월 22일
댓글: Haziq Hakim 2021년 3월 11일
I have data in data.speed which graphs in frames vs. pixels
I am trying to make it to show in seconds vs. cm
please help!!
it is 362 pixels in 5.7cm and 30 frames per second it is 360 seconds and 10800 frames the data is in a 10800 x 1 array

채택된 답변

dpb
dpb 2016년 6월 22일
편집: dpb 2016년 6월 22일
Gotta' know the frame rate and image resolution...if known, pretty simple to scale the axes; if not, "no way, no how"
"362 pixels in 5.7cm and 30 frames per second"
cmPer=5.7/362; % cm/pixel conversion
secPer=1/30; % sec/frame
t=secPer*[1:360*30]; % time vector in sec for t axis
v=cmPer*data.speed; % speed in cm/sec
plot(t,v)
You don't need the temporaries simply to plot, of course, but if want to keep the normalized data...
  댓글 수: 7
dpb
dpb 2021년 3월 2일
Well, you're almost there...
interval=150/1000; % 150 msec interval
N=numel(speed); % number samples --> length of speed array
t=0:interval:(N-1)*interval; % time vector to match
Haziq Hakim
Haziq Hakim 2021년 3월 11일
Apologies for the late reply. Thank you so much! This helped a lot :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by