Plotting and calculating difference
Show older comments
I have 2 matrix containing data of timestamps, 1 X Nth matrix I loaded them into the workspace and i want to plot the data on x axis and in the same figure. their size of matrix are different.
load('observations.mat');
load('control-times.mat');
index=880;
timestamp = ctrl_times(:,index:end);
obser_time = observation_times(:,1:end);
fig=figure;
hold on; axis equal;
plot(timestamp(1,:),'b*');
After plotting, how do i calculate the difference between data of the 2 matrices?
For example 1st data of timestamp - 1318496774.36108
however obser_time data starts from column 140 - 1318496774.90708
I would require looping if i am not wrong.
Thanks in advance.
6 Comments
Walter Roberson
on 13 Jan 2012
If the two matrices are 1 x N, N different between the two, then why does your code show them being accessed with a range index for both the first and second indices ? (:,index:end) and (:,1:end) are both syntaxes that suggest strongly that 2D matrices are being used.
Jw
on 13 Jan 2012
Walter Roberson
on 13 Jan 2012
Is your ctrl_times a row vector, or is it a matrix for which size(ctrl_times,1) is greater than 1 ? If it is a row vector, why do you confuse things by indexing it with : as its first element?
If they are row vectors as you appear to indicate, then clearer code would be
timestamp = ctrl_times(index:end);
obser_time = observation_times;
Jw
on 13 Jan 2012
Walter Roberson
on 13 Jan 2012
Okay, so now please expand on what you mean by obser_time data starts from column 140 ? Do you mean the first 139 columns are NaN, or do you mean that column 1 of obser_time logically corresponds to column 140 of timestamp ?
Jw
on 13 Jan 2012
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!