用MATLAB獲得三維曲面圖的語言? 50
瀏覽:1730
我想獲得如下三維曲面圖,用以下語言卻得到2D圖(提示嘗試引用非結構體數組的字段),不知道哪里錯了
請懂程序語言的大大們,幫忙解決一下。謝謝
網上查到語言:
[xz,y,z] = peaks;
f = figure;
[~, hc] = contourf(xz, y, z);
a1 = gca;
a2 = axes('Parent', f, 'Position', a1.Position);
hs = surf(xz, y, z, 'Parent', a2);
a1.Color = 'none';
a2.Color = 'none';
a1.ZLim = [0 1];
a2.ZLim = [-9 9];
a1.XTick = [];
a1.YTick = [];
a1.ZTick = [];
a1.Box = 'off';
a2.Box = 'off';
% Call after setting desired view on a2 (surf plot)
a1.View = a2.View;
把這段語言用MATLAB2014a實現出來是如下的2D圖
紅字提示:嘗試引用非結構體數組的字段。不知道上面語言哪里有錯誤




















