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

📄 c5_4_2.m

📁 dsp入门与实践一书的源代码
💻 M
字号:
error(nargchk(3,7,nargin));
	if nargin<4,
		mode = 'add';
			elseif ~strcmp(mode, 'per')&~strcmp(mode, 'add');
			error('invalid mode');
		end
	if nargin>5
		if ~strcmp(option, 'unif')&~strcmp(option, 'norm');
			error('invalid distribution option');
		end
		else
		option='unif';
	end
	if nargin>6
		v=version;
	if v(1) > 4
		rand('state', J);
		randn('state', J);
			else
				rand('seed', J);
				randn('seed', J);
			end
	end
t(1)=0;
	if strcmp(option, 'unif');
	if strcmp(mode, 'per');
		t=[1:N]./F_s+sqrt(6)*SM./F_s*(rand(1,N)-.5);
		t=t-t(1);
			elseif strcmp(mode, 'add');
				for ii=2:N,
					t(ii)=t(ii-1)+1./F_s+sqrt(12)*SM./F_s*(rand-.5);
				end
			end
			elseif strcmp(option, 'norm');
		if strcmp(mode, 'per');
			t=[1:N]./F_s+sqrt(2)*SM./2./F_s*(randn(1,N));
			t=t-t(1);
				elseif strcmp(mode, 'add');
					for ii=2:N,
					t(ii)=t(ii-1)+1./F_s+SM./F_s*(randn);
				end
		end
	end
if nargin>4
	t=t+t0;
end

⌨️ 快捷键说明

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