3D曲面图错位了轴

时间:2014-11-03 06:27:43

标签: matlab plot geometry-surface

代码是:

subplot(1,3,3)
h=surf(ReflMatrix)
set(h, 'edgecolor','none')
colormap winter %Other colourmaps: Winter,Cool
hold on;
ylabel('frequency (Hz)');
xlabel('angle of incidence (degrees)'); 
alpha(.5) %transparency

ReflMatrix是401x90。 y的值在0到90之间,这是好的,因为y是以度为单位测量的角度。 x(频率)的值范围从0到401,因为我的带宽是401个频率,但我想要相同的图表,其值范围从300到700(而不是从频率0开始到从频率300开始)。

1 个答案:

答案 0 :(得分:0)

surf中,您可以指定xy。在您的情况下,请通过

定义您的频率
y = linspace(300,700,401);

和阶段

x = linspace(0,90,91); 

您确定大小为ReflMatrix,因为从0到90的频率是91分而不是90分。然后根据

设置您的x和y参数
[X,Y] = meshgrid(x,y);
h = surf(X,Y,ReflMatrix);

修改

您可以通过

相应地设置轴的极限
xlim([0 90]);
ylim([300 700]);
zlim([min(min(ReflMatrix)) max(max(ReflMatrix))]);