If I understand correctly, you have for the corresponding x-values time from 0 to 50 minutes, so since you have 500 samples you have 10 samples per minute or an interval of 6 seconds between samples.
To get samples at a different rate, you can interpolate your signal using interp1
. If the signal you gave above is stored in Y
, you can interpolate it to 15 second intervals using:
x = 0:6:3000; % The original sample time, in seconds
xi = 0:15:3000; % The interpolated sample time, in seconds
Yi = interp1(x, Y, xi);
You can interpolate to any specified x-value within the original data, so for the varying sample rate you require you can define:
xi = [0:15:60, 90:30:120, 180:60:240, 440:200:2240];
Plotting of curves in MATLAB is usually done using the plot
function. For your interpolated data you can use:
figure;
plot(xi / 60, Yi);
xlabel('Time [min]');
ylabel('Signal [units]');
title('My signal');
Note how the time units have been changed from seconds to minutes for the plot. The rest of the commands given here are useful for plotting as well. figure
creates a new figure window for the plot and xlabel
, ylabel
and title
are used to annotate it.