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

📄 tstenv.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 2 页
字号:
                'Units','Rads')
set_param([sys,'/',['Signal',13,'Generator']],...
                'position',[35,53,80,87])


%     Subsystem  ['DSB-SC',13,'AM'].

new_system([sys,'/',['DSB-SC',13,'AM']])
set_param([sys,'/',['DSB-SC',13,'AM']],'Location',[112,331,527,488])

add_block('built-in/Product',[sys,'/',['DSB-SC',13,'AM/Product']])
set_param([sys,'/',['DSB-SC',13,'AM/Product']],...
           'position',[340,42,365,73])

add_block('built-in/Inport',[sys,'/',['DSB-SC',13,'AM/in_1']])
set_param([sys,'/',['DSB-SC',13,'AM/in_1']],...
                'position',[230,15,250,35])

add_block('built-in/Outport',[sys,'/',['DSB-SC',13,'AM/out_1']])
set_param([sys,'/',['DSB-SC',13,'AM/out_1']],...
             'position',[380,50,400,70])

add_block('built-in/Fcn',[sys,'/',['DSB-SC',13,'AM/Fcn']])
set_param([sys,'/',['DSB-SC',13,'AM/Fcn']],...
             'Expr','sin(u[1]*pi2+Ph)',...
           'position',[160,71,280,99])


%     Subsystem  ['DSB-SC',13,'AM/Module',13,'Integrator'].

new_system([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],'Location',[196,490,621,627])

add_block('built-in/Inport',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/in_1']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/in_1']],...
             'position',[35,15,55,35])

add_block('built-in/Memory',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Memory']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Memory']],...
                'orientation',2,...
             'x0','init',...
         'position',[210,75,260,105])

add_block('built-in/Fcn',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/module']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/module']],...
                'Expr','rem(u[1],modu)',...
             'position',[235,29,325,51])

add_block('built-in/Reset Integrator',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Reset',13,'integrator']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Reset',13,'integrator']],...
              'position',[110,19,150,51])

add_block('built-in/Constant',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/one']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/one']],...
          'orientation',3,...
             'move name',0,...
               'position',[70,55,90,75])

add_block('built-in/Sum',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Sum']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Sum']],...
         'position',[195,30,215,50])

add_block('built-in/Outport',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/out_1']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/out_1']],...
               'position',[370,30,390,50])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[205,90;180,90;190,45])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[155,35;190,35])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[220,40;230,40])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[60,25;105,25])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[80,50;80,35;105,35])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[330,40;365,40])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[340,40;340,90;265,90])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
               'Mask Display','Mod\nint',...
           'Mask Type','Module Integrator',...
             'Mask Dialogue','Module the given number when state exceed limit|Module bound:|Initial value:')
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
                'Mask Translate','init=@2; modu=@1;')
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
          'Mask Help','The absolute value of this integrator will not exceed the specified module bound. The state value is set to be zero when the module bound is reached. This block can only be used for scale value calculation.')
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
          'Mask Entries','1\/0\/')


%     Finished composite block ['DSB-SC',13,'AM/Module',13,'Integrator'].

set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
              'position',[75,64,140,106])

add_block('built-in/Constant',[sys,'/',['DSB-SC',13,'AM/Constant']])
set_param([sys,'/',['DSB-SC',13,'AM/Constant']],...
              'Value','Fc',...
                'position',[30,75,50,95])
add_line([sys,'/',['DSB-SC',13,'AM']],[285,85;305,85;305,65;335,65])
add_line([sys,'/',['DSB-SC',13,'AM']],[145,85;155,85])
add_line([sys,'/',['DSB-SC',13,'AM']],[55,85;70,85])
add_line([sys,'/',['DSB-SC',13,'AM']],[370,60;375,60])
add_line([sys,'/',['DSB-SC',13,'AM']],[255,25;310,25;310,50;335,50])
set_param([sys,'/',['DSB-SC',13,'AM']],...
             'Mask Display','DSB-SC\nAM',...
         'Mask Type','DSB-SC AM')
set_param([sys,'/',['DSB-SC',13,'AM']],...
              'Mask Dialogue','Double-sideband suppressed-carrier amplitude modulation:|Amplitude scale factor:|Carrier frequency (Hz):|Initial Phase (rad):',...
             'Mask Translate','Ac=@1;Fc=@2;Ph=@3;pi2=2*pi;')
set_param([sys,'/',['DSB-SC',13,'AM']],...
               'Mask Help','The Double-Sideband-Supressed-Carrier Amplitude Modulation causes the amplitude of the sinusoidal carrier to depend on the input message signal, resulting in amplitude modulation.')
set_param([sys,'/',['DSB-SC',13,'AM']],...
            'Mask Entries','1\/10\/0\/')


%     Finished composite block ['DSB-SC',13,'AM'].

set_param([sys,'/',['DSB-SC',13,'AM']],...
                'ForeGround',7,...
              'position',[125,52,185,88])

add_block('built-in/Mux',[sys,'/','Mux'])
set_param([sys,'/','Mux'],...
               'position',[385,48,415,82])


%     Subsystem  ['Auto-Scale',13,'Graph'].

new_system([sys,'/',['Auto-Scale',13,'Graph']])
set_param([sys,'/',['Auto-Scale',13,'Graph']],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/',['Auto-Scale',13,'Graph/x']])
set_param([sys,'/',['Auto-Scale',13,'Graph/x']],...
              'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['Auto-Scale',13,'Graph/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['Auto-Scale',13,'Graph/S-function',13,'M-file which plots',13,'lines',13,'']],...
          'function name','sfunyst',...
           'parameters','ax, color, npts, dt',...
          'position',[130,55,180,75])
add_line([sys,'/',['Auto-Scale',13,'Graph']],[90,65;125,65])
set_param([sys,'/',['Auto-Scale',13,'Graph']],...
                'Mask Display','plot(0,0,100,100,[83,76,63,52,42,38,28,16,11,84,11,11,11,90,90,11],[75,58,47,54,72,80,84,74,65,65,65,90,40,40,90,90])',...
              'Mask Type','Storage scope.')
set_param([sys,'/',['Auto-Scale',13,'Graph']],...
          'Mask Dialogue','Storage scope using MATLAB graph window.\nEnter plotting ranges and line type.|Initial Time Range:|Initial y-min:|Initial y-max:|Storage pts.:|Line type (rgbw-.:xo):|Sample time:')
set_param([sys,'/',['Auto-Scale',13,'Graph']],...
          'Mask Translate','npts = @4; color = @5; ax = [0, @1, @2, @3]; dt=@6;')
set_param([sys,'/',['Auto-Scale',13,'Graph']],...
                'Mask Help','Uses MATLAB''s graph window.\nUse only one block per system.\nLine type must be in quotes.\nSee the M-file sfunyst.m.')
set_param([sys,'/',['Auto-Scale',13,'Graph']],...
           'Mask Entries','5\/-1.2\/1.2\/200\/''y-/c-/g--/r-./w:/m*/ro/b+''\/0\/')


%     Finished composite block ['Auto-Scale',13,'Graph'].

set_param([sys,'/',['Auto-Scale',13,'Graph']],...
               'position',[465,45,495,85])


%     Subsystem  'Subsystem'.

new_system([sys,'/','Subsystem'])
set_param([sys,'/','Subsystem'],'Location',[137,87,780,222])

add_block('built-in/Note',[sys,'/',['Subsystem/The yellow signal is the inputed signal to be modulated. The signal is modulated by a amplitude',13,'modulator. The modulated signal is demodulated using PLL.                                                   ']])
set_param([sys,'/',['Subsystem/The yellow signal is the inputed signal to be modulated. The signal is modulated by a amplitude',13,'modulator. The modulated signal is demodulated using PLL.                                                   ']],...
                'ForeGround',5)
set_param([sys,'/',['Subsystem/The yellow signal is the inputed signal to be modulated. The signal is modulated by a amplitude',13,'modulator. The modulated signal is demodulated using PLL.                                                   ']],...
          'position',[330,45,335,50])

add_block('built-in/Note',[sys,'/','Subsystem/This test file is to test Envelop Detector, which is in utility section..'])
set_param([sys,'/','Subsystem/This test file is to test Envelop Detector, which is in utility section..'],...
              'ForeGround',2,...
              'position',[250,25,255,30])

add_block('built-in/Note',[sys,'/','Subsystem/The envelop detector can detector the upper envelop or the lower envelop of the input signal.'])
set_param([sys,'/','Subsystem/The envelop detector can detector the upper envelop or the lower envelop of the input signal.'],...
              'ForeGround',3,...
              'BackGround',6,...
              'position',[320,80,325,85])
set_param([sys,'/','Subsystem'],...
          'Mask Display','?')


%     Finished composite block 'Subsystem'.

set_param([sys,'/','Subsystem'],...
               'ForeGround',3,...
              'hide name',0,...
               'Drop Shadow',4,...
             'position',[440,165,470,201])
add_line(sys,[420,65;460,65])
add_line(sys,[85,70;120,70])
add_line(sys,[190,70;230,70])
add_line(sys,[105,70;105,20;345,20;345,50;380,50])
add_line(sys,[205,70;205,160;230,160])
add_line(sys,[300,160;335,160;335,80;380,80])
add_line(sys,[300,70;380,70])
add_line(sys,[205,70;205,35;325,35;325,60;380,60])

drawnow

% Return any arguments.
if (nargin | nargout)
      % Must use feval here to access system in memory
        if (nargin > 3)
         if (flag == 0)
                  eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
              else
                    eval(['ret =', sys,'(t,x,u,flag);'])
            end
     else
            [ret,x0,str,ts,xts] = feval(sys);
       end
else
 drawnow % Flash up the model and execute load callback
end

⌨️ 快捷键说明

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