⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dpzgui.m

📁 trabajos en matlab para verificar son muy buenos
💻 M
📖 第 1 页 / 共 2 页
字号:
function dpzgui(mode,ele_loc)
%DPZGUI Graphical User Interface program for pole-zero digital fliter design.


% ADSP Toolbox: Version 2.0 
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998


%v=matverch;
%if v<5,
%errordlg('This gui requires MATLAB 5.x and above','Version Error');
%return,
%end


if nargin == 0, mode = 0; end

if mode ~= 0,
   f = gcf;
   ui = get(f,'userdata');
   ele_axs = get(ui(12),'userdata');
   ele_mat = get(ui(1),'userdata');
   last_mode2 = get(ui(17),'userdata');
   edts = ui(6:2:12);
   curs_btn = ui(15);
   curs_dsp = ui(16:19);
   mag_axs=ui(27);
   phs_axs=ui(29);
   pz_axs=ui(23);
   sig_axs=ui(20);
end

if mode == 0,
   grey = [0.5,0.5,0.5];
   ltgrey = grey*1.5;
   dkgrey = grey*0.5;
   offwhite = grey*1.9;
   scrn_size = get(0,'screensize');
   fig_w = 620; fig_h = 450+16;
   flft = (scrn_size(3) - fig_w)/2;
   fbtm = (scrn_size(4) - fig_h)/2;

%   ver_str = version;
ver4=0;   %ver4    = length(findstr('4.',ver_str));
   if ver4,
      int_str = 'yes';
      f = figure('pos',[flft,fbtm,fig_w,fig_h],'menubar','none',...
  'name','Digital Filter Design by Pole-Zero Placement','numbertitle','off',...
            'resize','off','vis','off','interruptible',int_str,...
            'color',dkgrey,'defaultaxesfontsize',10,...
            'defaulttextfontsize',10);
   else
      int_str = 'on';
      eval('f = colordef(''new'',''none'');');
      set(f,'pos',[flft,fbtm,fig_w,fig_h],'menubar','none',...
 'name','Digital Filter Design by Pole-Zero Placement','numbertitle','off',...
           'resize','off','vis','off','interruptible',int_str,...
           'color',dkgrey,'defaultaxesfontsize',8,...
           'defaultuicontrolback',[0.5,0.5,0.5],...
           'defaulttextfontsize',8);
   end


%%% OPTIONS: 
   uim(1) = uimenu('label','OPTIONS');
   uim(2) = uimenu(uim(1),'label','Help and Info','callback','dpzhlp');
   uim(3) = uimenu(uim(1),'label','Export Data','separator','on',...
                          'callback','dpzgui(15)');
   uim(4) = uimenu(uim(1),'label','Print Figure','separator','on',...
                          'callback','printdlg(gcf)');
   uim(5) = uimenu(uim(1),'label','Close and Exit','separator','on',...
                          'callback','close(gcf)');
   uim(6) = uimenu('label','   Axis Limits','separator','on',...
                          'callback','dpzgui(17)');
   uim(7) = uimenu('label','   Zoom ON','separator','on',...
                          'callback','dpzgui(18)');
   uim(8) = uimenu('label','   Zoom OFF','separator','on',...
                          'callback','dpzgui(19)');
   uim(9) = uimenu('label','   RESIZE','callback','dpzgui(20)');


%%%%%%%


   lft = 10; btm = fig_h - 15 - 102;
   ui(1) = uicontrol('style','text','pos',[lft,btm+83,150,17],'back',grey,...
             'fore','c','string','Pole-Zero Information','horiz',...
             'left','callback','dpzgui(6)','value',1);
   ui(2) = axes('units','pixel','pos',[6,btm,175,102],'box','on',...
            'xtick',[],'ytick',[],'color',offwhite,'xcolor',ltgrey,...
            'ycolor',ltgrey');

   ui(3) = uicontrol('style','slider','pos',[166,btm-2,15,103],'min',-1,...
           'max',0,'callback','dpzedt(4)','vis','off');
   set(ui(2),'userdata',ui(3));

   ui(4) = uicontrol('style','frame','pos',[5,btm-126,175,121],...
           'back',grey,'fore',ltgrey);

   btm = btm - 30;
   ui(5) = uicontrol('style','text','pos',[lft,btm+2,55,17],...
           'string','Select','horiz','right','userdata',0);

   ui(6) = uicontrol('style','popup','pos',[lft+60,btm,105,20],...
           'back','w','string',['Pole|Zero']);

   btm = btm - 22;
   ui(7) = uicontrol('style','text','pos',[lft,btm,100,17],...
           'string','Multiplicity','horiz','right');
   ui(8) = uicontrol('style','edit','pos',[lft+105,btm,60,18],...
           'back','w','string','1');

   btm = btm - 22;
   ui(9) = uicontrol('style','text','pos',[lft,btm,100,17],...
           'horiz','right','string','Magnitude');
   ui(10) = uicontrol('style','edit','pos',[lft+105,btm,60,18],...
           'back','w','string','0.8','userdata',0);

   btm = btm - 22;
   ui(11) = uicontrol('style','text','pos',[lft,btm,100,17],...
           'horiz','right','string','Angle (deg)');
   ui(12) = uicontrol('style','edit','pos',[lft+105,btm,60,18],...
           'back','w','string','0');

   btm = btm - 25;
   ui(13) = uicontrol('style','push','pos',[lft+17,btm,60,20],...
           'string','Add','callback','dpzgui(2)');
   ui(14) = uicontrol('style','push','pos',[lft+87,btm,60,20],...
           'string','Del','callback','dpzedt(7)','enable','off');

   ui(40) = uicontrol('style','frame','pos',[5,btm-40,175,30],...
           'back',grey,'fore',ltgrey);

   btm = btm - 35;
   ui(41) = uicontrol('style','text','pos',[lft,btm,80,17],...
           'string','Gain Constant','fore','c','horiz','left');

   ui(42) = uicontrol('style','edit','pos',[lft+85,btm,80,20],...
           'string','1','back','w',...
           'callback','dpzplt');


   ui(31) = uicontrol('style','frame','pos',[5,btm-200+138-20+22,175,72-22],...
           'back',grey,'fore',ltgrey);

   btm = btm - 35;
   ui(32) = uicontrol('style','text','pos',[lft,btm,80,17],...
           'string','Freq Axis','fore','c','horiz','right');

   ui(33) = uicontrol('style','popup','pos',[lft+85,btm,80,20],...
           'string','F|Omega','back','w',...
           'callback','dpzplt');

   btm = btm - 22;
   ui(35) = uicontrol('style','text','pos',[lft,btm,80,17],...
           'string','Freq Lims','fore','c','horiz','right');


   ui(35) = uicontrol('style','edit','pos',[lft+85,btm,80,20],...
           'string','0,0.5','back','w',...
           'callback','dpzplt');



   uit1 = uicontrol('style','frame','pos',[5,btm-200+138-20+22,175,72-22],...
           'back',grey,'fore',ltgrey);

   btm = btm - 35;
   ui(46) = uicontrol('style','text','pos',[lft,btm,60,17],...
           'string','Time domain','fore','c');


   ui(47) = uicontrol('style','popup','pos',[lft+61,btm,105,20],...
           'string',['Impulse response|Step response'],'back','w',...
           'callback','dpzplt');

   btm = btm - 22;
   ui(36) = uicontrol('style','text','pos',[lft,btm,80,17],...
           'string','DT Index','fore','c','horiz','left');

   ui(37) = uicontrol('style','edit','pos',[lft+85,btm,80,20],...
           'string','0, 20','back','w',...
           'callback','dpzplt');

   btm = btm -35;
   ui(15) = uicontrol('style','check','pos',[lft+95,btm,70,20],...
           'string','Cursor','back','y','callback','dpzgui(6)');

   ui(61) = uicontrol('style','text','pos',[5,1,610,17],'horiz','left',...
           'userdata',0,'fore','b','back',offwhite);


   pos = get(f,'pos');
   lef = pos(3)-166;
   bot = pos(4)-21;

   ui(16) = uicontrol('style','text','pos',[lef,bot,20,20],...
           'string','X ','horiz','right');
   ui(17) = uicontrol('style','text','pos',[lef+20,bot,60,20],...
           'string','','back','w');
   ui(18) = uicontrol('style','text','pos',[lef+85,bot,20,20],...
           'string','Y ','horiz','right');
   ui(19) = uicontrol('style','text','pos',[lef+105,bot,60,20],...
           'string','','back','w');
   set(ui(16:19),'vis','off');


   ui(20) = axes('units','pixel','pos',[220,35+16,160,160],'box','on',...
             'color','k',...
             'xgrid','on','ygrid','on');
  title('Impulse Response h[n]');
   xlabel('DT Index  [n]');
   ui(21) = line('xdata',0,'ydata',0,'color','m','erase','back');
   if ver4,
      ui(22) = line('xdata',0,'ydata',0,'color','m','linestyle','o',...
                'erase','back');
   else
      ui(22) = line('xdata',0,'ydata',0,'color','m','linestyle','none',...
                    'marker','o','erase','back');
   end
   set(ui(20),'userdata',ui(21:22));


   ui(23) = axes('units','pixel','pos',[220,240+20,160,160],'box','on',...
            'color','k','xgrid','on','ygrid','on');
   title('Pole-Zero Plot');
   ui(26) = line('xdata',0,'ydata',0,'color','y','erase','back');
   if ver4,
      ui(24) = line('xdata',0,'ydata',0,'color','c','linestyle','o',...
                'erase','back');
   else
      ui(24) = line('xdata',0,'ydata',0,'color','c','linestyle','none',...
                    'marker','o','erase','back','markersize',8);
   end
   if ver4,
      ui(25) = line('xdata',0,'ydata',0,'color','g','linestyle','x',...
                'erase','back');
   else
      ui(25) = line('xdata',0,'ydata',0,'color','g','linestyle','none',...
                    'marker','x','erase','back','markersize',11);
   end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -