简体   繁体   English

MATLAB中的3D图形

[英]3D Graph in MATLAB

I want to draw a graph in MATLAB like this: 我想像这样在MATLAB中绘制图形:

图形

I have this dataset: 我有这个数据集:

资料集

I tried to use this code: 我尝试使用此代码:

s = [0  25  50  75  100]; 
t = [0; 25; 50; 75; 100]; 
[ss, tt] = meshgrid(s,t); 
u = [198 237 280 324 370; 
     237 270 310 354 399;
     280 310 348 390 434; 
     324 354 390 431 474; 
     370 399 434 474 516]; 

figure 
surf(ss,tt,u); 
rotate3d on 
xlabel('S[%]'); 
ylabel('T[%]'); 
zlabel('Umed[V]');

but I got this: 但是我得到了这个:

输出

What is wrong? 怎么了?

As Phil says, your plot shows more points than the table you are showing. 正如Phil所说,您的绘图显示的点数比所显示的表格多。 For instance, your table lists 5 points in the 'x' direction, but your plot looks like it has perhaps 100. So your code should produce the desired result once you use the "full" dataset. 例如,您的表在“ x”方向上列出了5个点,但是您的绘图看起来可能有100个点。因此,一旦使用“完整”数据集,您的代码应会产生所需的结果。

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

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