MATLAB: I have 2 time based traces of Current with varrying time stamps from each device ploted and would like to calculate the difference between the 2 traces in time The matrices are not equal and the time stamps are not equal

q(1)

Best Answer

  • It would help to have your data.
    I would use the interp1 function to equalise the time vectors and the values of the two traces. If your current vectors and their associated times are ‘Data1’,‘Time1’, and ‘Data2’,‘Time2’:
    Data1Intrp = interp1(Time1, Data1, Time2, 'linear', 'extrap'); % Interpolates ‘Data1’ To ‘Data2’ Time Base
    You can then compare them directly. Experiment to get the result you want. You can of course generate an entirely new time base and interpolate both with respect to it.