MATLAB:绘图/ XY保存在次要情节的意见网格功能 [英] MATLAB: Plotting/Saving X-Y views of mesh function in subplots

查看:1812
本文介绍了MATLAB:绘图/ XY保存在次要情节的意见网格功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,我试图挽救网格功能的2变量片(为.jpg,例如)作为一个插曲。我想用一个.m文件,因为我有很多情节生成做到这一点。我已经知道如何绘制自己人物的看法,但我不能让他们正确地画出一个图中的次要情节。为了说明我的意思:

As the title says, I'm trying to save the 2-variable slices of a mesh function (as a .jpg, for example) as a subplot. I want to do this using a .m file because I have many plots to generate. I have figured out how to plot the views on their own figures, but I cannot get them to plot properly as subplots within a figure. To illustrate what I mean:

下面是对个别地块的产出:

三维网格: 3D MATLAB网格图解
XY观点: XY MATLAB网格视图
YZ观点: YZ MATLAB网格视图
XZ观点: XZ MATLAB网格视图

Here are the outputs on individual plots:

3D mesh: 3D MATLAB mesh plot
XY view: XY MATLAB mesh view
YZ view: YZ MATLAB mesh view
XZ view: XZ MATLAB mesh view

和这里是我的绘图code(非工作):

And here is my plotting code (not working):

%Ambiguity Surface
fid = figure(fnum);
    axes1 = axes('Parent',fid);
    view(axes1,[-62.5 28]);
    grid(axes1,'on');
    hold(axes1,'all');
    msh = mesh(taux,fdy,z,'Parent',axes1);
    xlabel ('Delay - seconds');
    ylabel ('Doppler - Hz');
    zlabel ('Ambiguity function (Normalized Magnitude-Squared)');
    fname = strcat(name,' (Ambiguity Function z(\tau;F_d))');
    title(fname);
    cb = colorbar('peer',axes1);
    set(get(cb,'ylabel'),'String','Magnitude-Squared (dB)');
    hold off;
    printFig(fid,fnum,sname)
    fnum = fnum + 1;

%Ambiguity Slices
fid = figure(fnum);
    hold all;
    subplot(2,1,1);
        axes1 = axes();
        grid(axes1,'on');
        view(axes1,[90 0]);
        msh = mesh(taux,fdy,z);
        xlabel ('Delay - seconds','Visible','off');
        ylabel ('Doppler - Hz');
        zlabel ('Ambiguity function (Normalized Magnitude-Squared)','Visible','off');
        fname = strcat(name,' (Ambiguity Function Slice z(\tau;F_d) @ \tau = 128)');
        title(fname)
    subplot(2,1,2);
        axes2 = axes();
        grid(axes2,'on');
        view(axes2,[0 0]);
        msh = mesh(taux,fdy,z);
        xlabel ('Delay - seconds','Visible','off');
        ylabel ('Doppler - Hz','Visible','off');
        zlabel ('Ambiguity function (Normalized Magnitude-Squared)','Visible','off');
        cb = colorbar('peer',axes2);
        set(get(cb,'ylabel'),'String','Magnitude-Squared');
        fname = strcat(name,' (Ambiguity Function Slice z(\tau;F_d) @ F_d = 0)');
        title(fname)
    hold off;
    printFig(fid,fnum,slname)
    fnum = fnum+1;

printFig()只是设置目录信息并执行打印命令。

我的code设置在两个次要情节,然后覆盖的网格图解,这不是我想要一个完整的三维视图。我希望看到两人的意见(XZ和YZ)在一个单一的数字。

My code sets up the two subplots and then overlays a full 3-d view of the mesh plot, which is not what I want. I'd like to see two of the views (XZ and YZ) on a single figure.

感谢您的帮助!

-Dylan

编辑: 每@ Andrew_L的建议下,我在code修改如下:

Per @Andrew_L's suggestion, I modified this in my code:

sp1 = subplot(2,1,1);
       axes(sp1);
       axes1 = axes();
       grid(axes1,'on');
       view(axes1,[90 0]);
       msh = mesh(taux,fdy,z,'Parent',axes1);

这是重复其他次要情节。结果还是一样,但是。这似乎是成立的两个空白的次要情节正确,然后在它显示完整的伪3D绘图。

This is repeated for the other subplot. The result is still the same, however. It appears to set up the two blank subplots properly and then display the full pseudo-3D plot over it.

推荐答案

下面是一个精简的例子非常相似,你想达到什么样的:

Here is a stripped example very similar to what you are trying to achieve:

%# create axes, and set the view of each
hAx(1) = subplot(221); h = mesh(peaks);   view(3)
hAx(2) = subplot(222); copyobj(h,hAx(2)); view(0,90), title('X-Y')
hAx(3) = subplot(223); copyobj(h,hAx(3)); view(0,0) , title('X-Z')
hAx(4) = subplot(224); copyobj(h,hAx(4)); view(90,0), title('Y-Z')

%# set properties of axes
for i=1:4
    grid(hAx(i), 'on')
    axis(hAx(i), 'tight')
    xlabel(hAx(i), 'Delay (sec)');
    ylabel(hAx(i), 'Doppler (Hz)');
    zlabel(hAx(i), 'Ambiguity function');
end
title(hAx(1), 'Short Tone Ping z(\tau;F_d)')
hc = colorbar('Peer',hAx(1));
set(get(hc,'YLabel'), 'String','Magnitude-Squared (dB)')

这篇关于MATLAB:绘图/ XY保存在次要情节的意见网格功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆