MATLAB: How to subtract two 2D data sets with different resolutions

griddatainterp

Hi,
I have two sets of data as following:
Data set 1:
P1 162×1 double
T1 162×1 double
Data set 2:
P2 2400×1 double
T2 2400×1 double
As you can see, the resolutions of these two set of data are different. I want to subtract the plot (T1,P1) from plot(T2,P2). Since the number of elements are not similar how can I do that?
Thank you

Best Answer

PP1 = interp1(T1,P1,T2);
dP21_out = P2 - PP1;
plot(T2,P2);
hold on
plot(T2,PP1);