How to change units of a value?
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!