How to plot arrays of different lengths?
10 views (last 30 days)
Show older comments
Hello,
I exported data from a separate DAQ system to a .mat file. The DAQ system measured flow and differential pressure (DP) over the same time interval. The .mat file produced four data points of different lengths; flow(832750x1), flow_time(832750x1), DP(166550x1) and DP_time(166550x1).
I am able to plot flow and DP vs. time with separate y axes, but it makes it difficult to read. Is there any way to plot flow vs. DP? Thanks,
0 Comments
Accepted Answer
Star Strider
on 28 Jan 2019
I would use the interp1 (link) function to interpolate one vector in terms of the other vector’s time.
Example —
DP_in_flow_time = interp1(DP_time, DP, flow_time, 'linear','extrap'); % Expresses ‘DP’ As A Function Of ‘flow_time’
figure
plot(flow_time, flow)
hold on
plot(flow_time, DP_in_flow_time)
hold off
NOTE — This is UNTESTED CODE. It should work, however I cannot test it without the data.
2 Comments
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots 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!