【问题标题】:wxMaxima + gnuplot = Mathematica-like densitymap with a twistwxMaxima + gnuplot = 类似 Mathematica 的密度图
【发布时间】:2014-03-17 08:49:10
【问题描述】:

我想以类似于维基百科“切比雪夫滤波器”页面上的零极点图的方式绘制滤波器的频域响应:http://en.wikipedia.org/wiki/File:Chebyshev_Type_I_Filter_s-Plane_Response_(8th_Order).svg。特别是,我想要将图沿 Y 轴切成两半,并使切口突出以表示频率响应。

到目前为止,我已经设法得到这个:

可以看到制成的接缝,但并不突出,就像新焊接的一样。我希望你能理解这个意思,因为我现在找不到更好的解释。

现在,到目前为止,我所拥有的 wxMaxima 的 draw3d() 函数是这样的:

draw3d(logx=false,logy=false,logz=true,
enhanced3d=false,line_width=2,color=red,explicit(cabs(Hs(x+%i*y)),x,-0.01,0,y,-3,3),
enhanced3d=[z**.5,x,y,z],palette=gray,proportional_axes=xy,
/* cbrange=[0.05,100.95], */ view=[0,0],yv_grid=101,xu_grid=101,
explicit(cabs(Hs(x+%i*y)),x,-1,0,y,-3,3))$

前面已经定义了 Hs(s),比如:

Hs(s):=0.0248655/((s+0.210329)*(s^2+0.12999*s+0.521695)*(s^2+0.340319*s+0.22661))$

我不知道如何让频率响应突出,打印顺序似乎无关紧要。有谁知道它是否可以完成,如果可以,怎么做?

【问题讨论】:

    标签: gnuplot maxima frequency-analysis


    【解决方案1】:

    我不知道如何使用 maxima 来实现,但这里是一个仅使用 gnuplot 的解决方案。这使用+ 伪文件名来创建x=0 的一维绘图splot。复数用括号指定,{x,y},即i = {0,1}

    set terminal pngcairo size 1000,800
    set output 'chebyshev.png'
    
    N = 501
    set isosamples N
    set samples N
    set pm3d interpolate 3,3
    
    set palette gray
    set cbrange [*:10]
    set xrange [-1:0]
    set yrange [-3:3]
    
    set logscale z
    set autoscale zfix
    
    set view 120,278
    unset key
    set grid
    
    Hs(s) = 0.0248655/((s+0.210329)*(s**2+0.12999*s+0.521695)*(s**2+0.340319*s+0.22661))
    
    splot abs(Hs(x+{0,1}*y)) w pm3d, \
          '+' using (y = ($0/(N-1.0) * 6 - 3), 0):(y):(abs(Hs({0,1}*y))) w l lw 3
    

    4.6.3 的结果是:

    【讨论】:

    • 感谢您的回复,我像机器人一样按照您的步骤操作,但是使用 4.6 补丁级别 3(来自终端),我得到了这个:s28.postimg.org/oaahkt55p/chebyshev.png。左下角有一些红色,但是……这是我的步骤:
    • gnuplot> set terminal pngcairo size 1000,800 Terminal type set to 'pngcairo' Options are ' background "#ffffff" fontscale 1.0 size 1000, 800 ' gnuplot> set output 'chebyshev.png' gnuplot> N=501 gnuplot> set isosamples N gnuplot> set samples N gnuplot> set pm3d interpolate 3,3 gnuplot> set palette gray gnuplot> set cbrange [*:10] gnuplot> set xrange [-1:0] gnuplot> set yrange [ -3:3] gnuplot> 设置 logscale z gnuplot> 设置自动缩放 zfix gnuplot> 设置视图 120,278 gnuplot> 取消设置键 gnuplot> 设置网格
    • gnuplot> Hs(s)=0.0248655/((s+0.210329)*(s2+0.12999*s+0.521695)*(s2+0.340319*s+ 0.22661)) gnuplot> splot abs(Hs(x+{0,1}*y)) w pm3d, \ >'+' using (y=($0/(N-1.0)*6+3),0):( y):(abs(Hs({0,1}*y))) w l lw 3 Fontconfig 错误:“misc.conf”,第 50 行:无效属性 'name' Fontconfig 错误:“misc.conf”,第 59 行:无效属性“名称”Fontconfig 错误:“misc.conf”,第 70 行:无效属性“名称”gnuplot>
    • 对于四倍的帖子我很抱歉,点击 似乎没有换行。另外,我不知道如何在此处(在 cmets 中)添加
    • 代码看起来不错。我刚刚用上面的代码再次测试,它在 4.6.3 甚至 4.4.4 在 Linux 上都能正常工作。将上面的代码(可能在开头放一个reset)保存在文件chebyshe.gp 中,然后在gnuplot 提示符下调用gnuplot chebyshev.gp 或使用load 'chebyshev.gp'。不知道Fontconfig错误会不会有一些意想不到的后果。也许尝试不同的终端,例如set terminal png size 1000,800。如果您只使用 splot '+'... 部分,是否会显示该行?
    猜你喜欢
    • 2013-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-20
    • 2011-11-09
    • 1970-01-01
    • 2023-03-06
    相关资源
    最近更新 更多