DSP原理及其C编程开发技术.rar

源代码在线查看: wbsignal.m

软件大小: 1283 K
上传用户: teasler111
关键词: DSP 编程 开发技术
下载地址: 免注册下载 普通下载 VIP

相关代码

				%wbsignal.m Generates wide band random sequence.Represents one info bit
				
				len_code = 128;  				 %length of random sequence 
				code = 2*round(rand(1,len_code))-1;  %generates random sequence {1,-1}
				sample_rate = 2;          		 %up-sampling from 4 to 8 kHz
				NS = len_code * sample_rate;         %length of up-sampled sequence
				sig = zeros(1,NS);                   %initialize random sequence
				for i = 1:len_code                   %obtain up-sampled random sequence
				   sig((i-1)*sample_rate + 1:i*sample_rate) = code(i);
				end;
				wbsignal = sig*5000;             	 %scale for p-p amplitude of 500 mV
				
				fid=fopen('wbsignal.h','w');         %open file for wideband signal
				fprintf(fid,'#define NS 256 //number of output sample points\n\n');
				fprintf(fid,'short wbsignal[256]={');
				fprintf(fid,'%d, ' ,wbsignal(1:NS-1));
				fprintf(fid,'%d' ,wbsignal(NS));
				fprintf(fid,'};\n\n'); 
				fclose(fid);
				return;
				
							

相关资源