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

📄 sdm.m

📁 非常经典的MATLAB/SIMULINK入门书籍,主要围绕信号与系统来讲,里面带有很多SIMULINK的仿真源程序,看后会收获很大.
💻 M
📖 第 1 页 / 共 2 页
字号:
add_block('built-in/Gain',[sys,'/',['Dirty Square',13,'Wave1/Gain3']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Gain3']],...
		'BackGround',3,...
		'Gain','1/9',...
		'position',[140,238,185,262])

add_block('built-in/Gain',[sys,'/',['Dirty Square',13,'Wave1/Gain2']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Gain2']],...
		'BackGround',3,...
		'Gain','1/7',...
		'position',[140,185,185,215])

add_block('built-in/Gain',[sys,'/',['Dirty Square',13,'Wave1/Gain1']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Gain1']],...
		'BackGround',3,...
		'Gain','1/5',...
		'position',[140,135,185,165])

add_block('built-in/Gain',[sys,'/',['Dirty Square',13,'Wave1/Gain']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Gain']],...
		'BackGround',3,...
		'Gain','1/3',...
		'position',[140,93,180,117])

add_block('built-in/Sine Wave',[sys,'/',['Dirty Square',13,'Wave1/Sine Wave4']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Sine Wave4']],...
		'BackGround',3,...
		'frequency','6220.4',...
		'position',[60,240,80,260])

add_block('built-in/Sine Wave',[sys,'/',['Dirty Square',13,'Wave1/Sine Wave3']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Sine Wave3']],...
		'BackGround',3,...
		'frequency','4838.1',...
		'position',[60,190,80,210])

add_block('built-in/Sine Wave',[sys,'/',['Dirty Square',13,'Wave1/Sine Wave2']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Sine Wave2']],...
		'BackGround',3,...
		'frequency','3455.8',...
		'position',[60,140,80,160])

add_block('built-in/Sine Wave',[sys,'/',['Dirty Square',13,'Wave1/Sine Wave1']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Sine Wave1']],...
		'BackGround',3,...
		'frequency','2073.5',...
		'position',[60,95,80,115])

add_block('built-in/Sine Wave',[sys,'/',['Dirty Square',13,'Wave1/Sine Wave']])
set_param([sys,'/',['Dirty Square',13,'Wave1/Sine Wave']],...
		'BackGround',3,...
		'frequency','691',...
		'sampletime','0',...
		'position',[60,50,80,70])

add_block('built-in/Outport',[sys,'/',['Dirty Square',13,'Wave1/out_1']])
set_param([sys,'/',['Dirty Square',13,'Wave1/out_1']],...
		'position',[420,70,440,90])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[380,80;415,80])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[190,250;325,250;325,100;350,100])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[190,200;305,200;305,90;350,90])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[190,150;285,150;285,80;350,80])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[185,105;255,105;255,70;350,70])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[85,60;350,60])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[85,250;135,250])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[85,200;135,200])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[85,150;135,150])
add_line([sys,'/',['Dirty Square',13,'Wave1']],[85,105;135,105])


%     Finished composite block ['Dirty Square',13,'Wave1'].

set_param([sys,'/',['Dirty Square',13,'Wave1']],...
		'position',[80,330,110,380])

add_block('built-in/Scope',[sys,'/','Scope4'])
set_param([sys,'/','Scope4'],...
		'Vgain','1.500000',...
		'Hgain','0.010000',...
		'Vmax','3.000000',...
		'Hmax','0.020000',...
		'Window',[0,397,383,597],...
		'position',[785,245,815,275])

add_block('built-in/Scope',[sys,'/','Scope'])
set_param([sys,'/','Scope'],...
		'Vgain','1.500000',...
		'Hgain','0.010000',...
		'Vmax','3.000000',...
		'Hmax','0.020000',...
		'Window',[0,0,383,200],...
		'position',[245,30,275,60])

add_block('built-in/Zero-Order Hold',[sys,'/',['Zero-Order',13,'Hold']])
set_param([sys,'/',['Zero-Order',13,'Hold']],...
		'Sample time','1/512000',...
		'position',[455,109,490,141])

add_block('built-in/Integrator',[sys,'/','Integrator'])
set_param([sys,'/','Integrator'],...
		'position',[335,114,365,136])


%     Subsystem  'Decimation1'.

new_system([sys,'/','Decimation1'])
set_param([sys,'/','Decimation1'],'Location',[129,578,559,704])

add_block('built-in/Discrete State-Space',[sys,'/',['Decimation1/Chebyshev Type I',13,'IIR Lowpass']])
set_param([sys,'/',['Decimation1/Chebyshev Type I',13,'IIR Lowpass']],...
		'A','a',...
		'B','b',...
		'C','c',...
		'D','d',...
		'Sample time','ts',...
		'Mask Display','plot(1:64,abs(h))',...
		'Mask Type','cheby1')
set_param([sys,'/',['Decimation1/Chebyshev Type I',13,'IIR Lowpass']],...
		'Mask Dialogue','IIR Chebychev type I low pass filter.|Cutoff frequency (0 to 1):|Order:|Db ripple in passband:|Sample time:')
set_param([sys,'/',['Decimation1/Chebyshev Type I',13,'IIR Lowpass']],...
		'Mask Translate','[a,b,c,d]=cheby1(@2,@3,@1); ts=@4; [num,den]=ss2tf(a,b,c,d,1); if (@2 <= 8), [a,b,c,d]=tf2ss(num,den); end; h=freqz(num,den,64); ')
set_param([sys,'/',['Decimation1/Chebyshev Type I',13,'IIR Lowpass']],...
		'Mask Help','IIR Chebychev type I low pass filter designed using MATLAB''s cheby1 command. Implemented in state-space form. Filters of order 8 or less are implemented in controller canonical form for improved efficiency.')
set_param([sys,'/',['Decimation1/Chebyshev Type I',13,'IIR Lowpass']],...
		'Mask Entries','0.8/r\/8\/.05\/ts\/',...
		'position',[130,41,165,69])

add_block('built-in/Outport',[sys,'/','Decimation1/out_1'])
set_param([sys,'/','Decimation1/out_1'],...
		'position',[290,45,310,65])

add_block('built-in/Inport',[sys,'/','Decimation1/in_1'])
set_param([sys,'/','Decimation1/in_1'],...
		'position',[45,45,65,65])

add_block('built-in/Zero-Order Hold',[sys,'/',['Decimation1/Zero-Order',13,'Hold']])
set_param([sys,'/',['Decimation1/Zero-Order',13,'Hold']],...
		'Sample time','ts*r',...
		'position',[225,39,260,71])
add_line([sys,'/','Decimation1'],[170,55;220,55])
add_line([sys,'/','Decimation1'],[70,55;125,55])
add_line([sys,'/','Decimation1'],[265,55;285,55])
set_param([sys,'/','Decimation1'],...
		'Mask Display','x[nR]',...
		'Mask Type','Decimate',...
		'Mask Dialogue','Decimate input by integer factor.|Decimation factor R:|Input sample time:',...
		'Mask Translate','r=@1;ts=@2;')
set_param([sys,'/','Decimation1'],...
		'Mask Help','Passes the input signal through an 8th order Chebyshev Type I IIR Lowpass filter with passband ripple of 0.05 dB to reduce aliasing. Subsamples the filtered signal at a rate R times slower than the base sample rate defined by the Sample time.')
set_param([sys,'/','Decimation1'],...
		'Mask Entries','4\/1/128000\/')


%     Finished composite block 'Decimation1'.

set_param([sys,'/','Decimation1'],...
		'position',[640,109,680,141])


%     Subsystem  'Decimation2'.

new_system([sys,'/','Decimation2'])
set_param([sys,'/','Decimation2'],'Location',[129,578,559,704])

add_block('built-in/Zero-Order Hold',[sys,'/',['Decimation2/Zero-Order',13,'Hold']])
set_param([sys,'/',['Decimation2/Zero-Order',13,'Hold']],...
		'Sample time','ts*r',...
		'position',[225,39,260,71])

add_block('built-in/Inport',[sys,'/','Decimation2/in_1'])
set_param([sys,'/','Decimation2/in_1'],...
		'position',[45,45,65,65])

add_block('built-in/Outport',[sys,'/','Decimation2/out_1'])
set_param([sys,'/','Decimation2/out_1'],...
		'position',[290,45,310,65])

add_block('built-in/Discrete State-Space',[sys,'/',['Decimation2/Chebyshev Type I',13,'IIR Lowpass']])
set_param([sys,'/',['Decimation2/Chebyshev Type I',13,'IIR Lowpass']],...
		'A','a',...
		'B','b',...
		'C','c',...
		'D','d',...
		'Sample time','ts',...
		'Mask Display','plot(1:64,abs(h))',...
		'Mask Type','cheby1')
set_param([sys,'/',['Decimation2/Chebyshev Type I',13,'IIR Lowpass']],...
		'Mask Dialogue','IIR Chebychev type I low pass filter.|Cutoff frequency (0 to 1):|Order:|Db ripple in passband:|Sample time:')
set_param([sys,'/',['Decimation2/Chebyshev Type I',13,'IIR Lowpass']],...
		'Mask Translate','[a,b,c,d]=cheby1(@2,@3,@1); ts=@4; [num,den]=ss2tf(a,b,c,d,1); if (@2 <= 8), [a,b,c,d]=tf2ss(num,den); end; h=freqz(num,den,64); ')
set_param([sys,'/',['Decimation2/Chebyshev Type I',13,'IIR Lowpass']],...
		'Mask Help','IIR Chebychev type I low pass filter designed using MATLAB''s cheby1 command. Implemented in state-space form. Filters of order 8 or less are implemented in controller canonical form for improved efficiency.')
set_param([sys,'/',['Decimation2/Chebyshev Type I',13,'IIR Lowpass']],...
		'Mask Entries','0.8/r\/8\/.05\/ts\/',...
		'position',[130,41,165,69])
add_line([sys,'/','Decimation2'],[265,55;285,55])
add_line([sys,'/','Decimation2'],[70,55;125,55])
add_line([sys,'/','Decimation2'],[170,55;220,55])
set_param([sys,'/','Decimation2'],...
		'Mask Display','x[nR]',...
		'Mask Type','Decimate',...
		'Mask Dialogue','Decimate input by integer factor.|Decimation factor R:|Input sample time:',...
		'Mask Translate','r=@1;ts=@2;')
set_param([sys,'/','Decimation2'],...
		'Mask Help','Passes the input signal through an 8th order Chebyshev Type I IIR Lowpass filter with passband ripple of 0.05 dB to reduce aliasing. Subsamples the filtered signal at a rate R times slower than the base sample rate defined by the Sample time.')
set_param([sys,'/','Decimation2'],...
		'Mask Entries','4\/1/32000\/')


%     Finished composite block 'Decimation2'.

set_param([sys,'/','Decimation2'],...
		'position',[735,109,775,141])

add_block('built-in/Scope',[sys,'/','Scope5'])
set_param([sys,'/','Scope5'],...
		'Vgain','1.500000',...
		'Hgain','0.010000',...
		'Vmax','3.000000',...
		'Hmax','0.020000',...
		'Window',[381,397,770,596],...
		'position',[755,175,785,205])
add_line(sys,[425,125;450,125])
add_line(sys,[495,125;520,125;520,45;550,45])
add_line(sys,[305,125;330,125])
add_line(sys,[370,125;385,125])
add_line(sys,[495,125;510,125;510,185;260,185;260,130;275,130])
add_line(sys,[595,125;635,125])
add_line(sys,[685,125;730,125])
add_line(sys,[55,120;95,120])
add_line(sys,[510,125;545,125])
add_line(sys,[780,125;790,35])
add_line(sys,[205,120;275,120])
add_line(sys,[220,120;220,45;240,45])
add_line(sys,[145,120;165,120])
add_line(sys,[595,125;610,125;610,260;780,260])
add_line(sys,[685,125;710,125;710,190;750,190])

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 + -