## Plotting graph with uneven amount of vectors

### maximumdv (view profile)

on 14 Feb 2019
Latest activity Commented on by Walter Roberson

on 14 Feb 2019

### Walter Roberson (view profile)

Hello everyone,
So, I want to plot a graph pressure over volume. Both values have been measured over a time of 0.85 seconds, however the pressure has been recorded at a 170 moments and the volume has been recorded at only 69 moments. How can I make this work?

### Walter Roberson (view profile)

on 14 Feb 2019

take the later of the two start times and the earlier of the two end times. linspace some points between the two. interp1 the pressure at those query points and the temperature at those query points . Now you can plot the interpolated values against each other .

maximumdv

### maximumdv (view profile)

on 14 Feb 2019
Both values have been recorded from 0-0.85 seconds the pressure has just been recorded more often. Also the graph is supposed to look like a loop, a pressure-volume loop so using linspace for some points does not really work. Do you have any other suggestions?
Walter Roberson

### Walter Roberson (view profile)

on 14 Feb 2019
you would linspace on time. Time will not loop but the parametric plot of pressure vs volume could loop.
Walter Roberson

### Walter Roberson (view profile)

on 14 Feb 2019
N = 100;
qt = linspace(0, 0.85, N);
qp = interp1(times_pressure_recorded_at, recorded_pressures, qt);
qv = interp1(times_volume_recorded_at, recorded_volumes, qt);
plot(qv, qp);