简体   繁体   English

Matlab-沿第3维的多个2D图

[英]Matlab - Multiple 2D plots along a 3rd dimension

I'm trying to plot many 2D plots (x,y). 我正在尝试绘制许多2D图(x,y)。

But... each 2D plot is for a constant z. 但是...每个2D图都是一个常数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. 所以实际上我的数据是(x,y,z)而不是z(x,y),我相信这是使用“ surf”命令的要求。

Could anyone help with this? 有人可以帮忙吗?

Example, x = velocity y = drag 例如,x =速度y =阻力

I have multiple runs of y(x) for a constant temperature, z. 对于恒温z,我需要运行y(x)多次。

I just want to plot each (x,y) along a 3rd axis, temperature z. 我只想沿着第三轴温度z绘制每个(x,y)。

Ideally I'd also want some sort of contour between the (x,y) plots so I can show the peaks/troughs etc. 理想情况下,我还希望在(x,y)曲线之间有某种轮廓,以便显示峰/谷等。

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 . 如果运行不是独立的(多次运行有某种趋势),那么使用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). 然后,您需要构造数据以拥有X,Y和Z-在这种情况下,我建议您将阻力测量值用作Z(高度)。

Assuming that you have all the drag/velocity data in drag and velocity which are both of size [data points x number of runs]: 假设您具有所有的阻力/速度数据,其dragvelocity均为大小[数据点x行程数]:

% 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')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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