简体   繁体   中英

Matlab - Multiple 2D plots along a 3rd dimension

I'm trying to plot many 2D plots (x,y).

But... each 2D plot is for a constant z.

So really my data is (x,y,z) but not z(x,y), which I believe are the requirements for using the "surf" command.

Could anyone help with this?

Example, x = velocity y = drag

I have multiple runs of y(x) for a constant temperature, z.

I just want to plot each (x,y) along a 3rd axis, temperature z.

Ideally I'd also want some sort of contour between the (x,y) plots so I can show the peaks/troughs etc.

Any help would be great.

If the runs are not independent (there is some trend over multiple runs) then it may make sense to use surf . You then need to construct your data such you have an X,Y, and Z - in this case I'd suggest you use the drag measurements as your Z (height).

Assuming that you have all the drag/velocity data in drag and velocity which are both of size [data points x number of runs]:

% construct matrix of run numbers
runs = repmat(1:numruns, [1, datapoints]); 
runs = reshape(runs, datapoints, numruns);

% plot and label
surf(runs,velocity,drag);
xlabel('runs')
ylabel('velocity')
zlabel('drag')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM