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

📄 tddmmfsk.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 4 页
字号:
		'position',[140,108,160,132])

add_block('built-in/Constant',[sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Shift key']])
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Shift key']],...
		'Value','sft',...
		'position',[120,43,140,67])

add_block('built-in/S-Function',[sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Scheduled',13,'reset-int']])
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Scheduled',13,'reset-int']],...
		'function name','schdint',...
		'parameters','td, ts, limit',...
		'Mask Display','Schdld\nreset-int')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Scheduled',13,'reset-int']],...
		'Mask Type','Scheduled reset integration.')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Scheduled',13,'reset-int']],...
		'Mask Dialogue','Reset the state to be zero(s) at the scheduled reset point.|Scheduled reset time inteval and offset:|Sample time and offset:|Modulo bound:')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Scheduled',13,'reset-int']],...
		'Mask Translate','td=@1;ts=@2;limit=@3;')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Scheduled',13,'reset-int']],...
		'Mask Help','This block resets the state(s) to be zero(s) at the begining of reset time inteval. The reset inteval can be a two elements vector with the second element being offset.')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Scheduled',13,'reset-int']],...
		'Mask Entries','td\/ts\/Inf\/',...
		'position',[200,34,260,76])

add_block('built-in/Sum',[sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Sum1']])
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband/Sum1']],...
		'inputs','+++',...
		'position',[325,70,350,110])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[810,95;820,95])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[515,85;535,85])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[765,100;780,100])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[765,85;780,85])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[705,95;715,95])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[645,95;655,95;655,100;670,100])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[645,95;655,95;655,85;670,85])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[570,95;575,95])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[525,100;535,100])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[460,100;465,100])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[410,130;420,110])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[355,90;420,90])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[360,165;370,165;380,135])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[355,90;370,90;380,120])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[235,195;240,195;240,180;260,180])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[170,165;260,165])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[180,165;190,195])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[295,175;310,175;320,105])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[120,165;140,165])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[165,120;290,120;290,90;320,90])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[265,55;285,55;285,75;320,75])
add_line([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],[145,55;195,55])
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],...
		'Mask Display','Noncohe\nMFSK dm\ncorr',...
		'Mask Type','Passband non-coherent MFSK correlation')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],...
		'Mask Dialogue','Compute MFSK correlation. Take MFSK\nmodulated signal. Output a vector of\ncorrelation result.|M-ary number (input in range [0, M-1]):|Tone space (Hz):|Symbol interval and offset (sec):|Carrier frequency (Hz):|Initial phase (rad):|Sample time (sec):')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],...
		'Mask Translate','pi2=2*pi;N=@1;Fc=@4*pi2;Ph=@5;Ton=@2;sft=[0:N-1]*Ton*pi2;td=@3;ts=@6;')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],...
		'Mask Help','This block calculates the noncoherent correlation value of the input signal with a vector of sinusoidal signals. These sinusoidal signals have their frequency the same as that of FM modulated signal of possible resulting digits. The output is an M length vector. M is the M-ary number. The MFSK demodulation result is the index of the largest output, using the Min/max demap block.')
set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],...
		'Mask Entries','M\/Ton\/td\/Fc\/Ph\/ts\/')


%     Finished composite block ['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband'].

set_param([sys,'/',['Noncoherent',13,'MFSK demod/Non-coh MFSK dm',13,'corr passband']],...
		'position',[105,68,185,112])

add_block('built-in/Inport',[sys,'/',['Noncoherent',13,'MFSK demod/in_1']])
set_param([sys,'/',['Noncoherent',13,'MFSK demod/in_1']],...
		'position',[25,80,45,100])

add_block('built-in/Outport',[sys,'/',['Noncoherent',13,'MFSK demod/out_1']])
set_param([sys,'/',['Noncoherent',13,'MFSK demod/out_1']],...
		'position',[375,80,395,100])
add_line([sys,'/',['Noncoherent',13,'MFSK demod']],[190,90;225,90])
add_line([sys,'/',['Noncoherent',13,'MFSK demod']],[50,90;100,90])
add_line([sys,'/',['Noncoherent',13,'MFSK demod']],[315,90;370,90])
set_param([sys,'/',['Noncoherent',13,'MFSK demod']],...
		'Mask Display','plot(0,0,100,100,x,y);Nonc MFSK',...
		'Mask Type','Passband MPSK demodulation')
set_param([sys,'/',['Noncoherent',13,'MFSK demod']],...
		'Mask Dialogue','Demodulate a MFSK modulated signal using noncoherent method.|M-ary number (output digits in range [0, M-1]):|Tone space (Hz):|Symbol interval (sec):|Carrier frequency (Hz):|Initial phase (rad):|Sample time (sec):')
set_param([sys,'/',['Noncoherent',13,'MFSK demod']],...
		'Mask Translate','M=@1;Fc=@4;Ph=@5;Ton=@2;td=@3;ts=@6;[x,y]=moduicon(8);')
set_param([sys,'/',['Noncoherent',13,'MFSK demod']],...
		'Mask Help','This block demodulates a MFSK modulated signal using noncoherent method. The tone space is the frequency distance between two consecutive after the modulation. The inputs are integers in the range [0, M-1], where M is the M-ary number. When the symbol interval is a two-element vector, the second element is the offset (default 0).')
set_param([sys,'/',['Noncoherent',13,'MFSK demod']],...
		'Mask Entries','M\/M/td/5\/td\/100\/0\/ts\/')


%     Finished composite block ['Noncoherent',13,'MFSK demod'].

set_param([sys,'/',['Noncoherent',13,'MFSK demod']],...
		'hide name',0,...
		'position',[425,138,505,182])


%     Subsystem  ['AWGN',13,'channel'].

new_system([sys,'/',['AWGN',13,'channel']])
set_param([sys,'/',['AWGN',13,'channel']],'Location',[11,262,273,408])

add_block('built-in/Inport',[sys,'/',['AWGN',13,'channel/in_1']])
set_param([sys,'/',['AWGN',13,'channel/in_1']],...
		'position',[45,10,65,30])

add_block('built-in/Outport',[sys,'/',['AWGN',13,'channel/out_1']])
set_param([sys,'/',['AWGN',13,'channel/out_1']],...
		'position',[200,55,220,75])

add_block('built-in/Sum',[sys,'/',['AWGN',13,'channel/Sum']])
set_param([sys,'/',['AWGN',13,'channel/Sum']],...
		'position',[150,55,170,75])


%     Subsystem  ['AWGN',13,'channel/Gaussian noise',13,'generator'].

new_system([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],'Location',[22,119,370,243])

add_block('built-in/State-Space',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Matrix',13,'Gain']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','K',...
		'Mask Type','Matrix Gain')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
		'Mask Dialogue','Matrix Gain.|Gain matrix:',...
		'Mask Translate','K = @1;')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','d\/',...
		'position',[140,61,165,89])

add_block('built-in/White Noise',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Random',13,'Number']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Random',13,'Number']],...
		'Seed','s',...
		'position',[35,57,80,93])

add_block('built-in/Constant',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Constant']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Constant']],...
		'Value','m',...
		'position',[140,20,160,40])

add_block('built-in/Sum',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Sum']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Sum']],...
		'position',[220,60,240,80])

add_block('built-in/Outport',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/out_1']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/out_1']],...
		'position',[285,60,305,80])
add_line([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],[165,30;190,30;190,65;215,65])
add_line([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],[245,70;280,70])
add_line([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],[170,75;215,75])
add_line([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],[85,75;135,75])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
		'Mask Display','plot(0,0,100,100,x,y);Gaussian',...
		'Mask Type','Gaussian noise generator')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
		'Mask Dialogue','Generate Gaussian distributed noise with\ngiven mean and variance value.|Mean value:|Variance (vector or matrix):|Initial seed:')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
		'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);[x,y]=srcsicon(3);')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
		'Mask Help','When the mean value and seed are vectors, the output of this block is a vector. The length of the vector is the same as the length of the mean value vector or the length of the seed. When the variance entry is a vector, the variance is a diagonal matrix.')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
		'Mask Entries','m\/d\/s\/')


%     Finished composite block ['AWGN',13,'channel/Gaussian noise',13,'generator'].

set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
		'position',[25,48,105,92])
add_line([sys,'/',['AWGN',13,'channel']],[175,65;195,65])
add_line([sys,'/',['AWGN',13,'channel']],[70,20;115,20;115,60;145,60])
add_line([sys,'/',['AWGN',13,'channel']],[110,70;145,70])
set_param([sys,'/',['AWGN',13,'channel']],...
		'Mask Display','plot(0,0,100,100,x,y);AWGN',...
		'Mask Type','AWGN channel, fixed parameter')
set_param([sys,'/',['AWGN',13,'channel']],...
		'Mask Dialogue','Additive white Gaussian noise channel\nwith fixed mean and variance.|Mean value:|Variance (std^2):|Initial Seed:')
set_param([sys,'/',['AWGN',13,'channel']],...
		'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);[x,y]=chanicon;')
set_param([sys,'/',['AWGN',13,'channel']],...
		'Mask Help','This block adds white Gaussian noise to the input signal. The mean and the variance can be a scalar or vector with the same length as the input signal.')
set_param([sys,'/',['AWGN',13,'channel']],...
		'Mask Entries','0\/.001\/12345\/')


%     Finished composite block ['AWGN',13,'channel'].

set_param([sys,'/',['AWGN',13,'channel']],...
		'position',[275,63,355,107])
add_line(sys,[125,85;140,85;140,25;586,25;586,80;605,80])
add_line(sys,[585,100;605,100])
add_line(sys,[140,85;165,85])
add_line(sys,[505,85;540,85])
add_line(sys,[510,160;520,160;520,110;540,110])
add_line(sys,[255,85;270,85])
add_line(sys,[360,85;415,85])
add_line(sys,[385,85;385,160;420,160])

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