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

📄 c3ex11.m

📁 数字信号处理Matlab实现?中藕糯鞰atlab实现数字信号处理Matlab实现
💻 M
字号:
%	Plots for Example 3-11%RC = input('Enter vector of RC time constant of filter (sq. wave period = 1) ');n_max = input('Enter highest harmonic value desired (odd) ');N_RC = length(RC);omega_0 = 2*pi;f0 = 1;for k = 1:N_RC	n = [-n_max:2:n_max];	f = [-n_max*f0:.02:n_max*f0];	H = 1./(1+j*2*pi*f*RC(k));	L_n = length(n);	nn = 2:L_n/2+1;	sgn = (-1).^nn;		% 	Fourier coefficients for square wave; 	X_n = (2./(pi*abs(n))).*[fliplr(sgn) sgn];%	Fourier coefficients of output	Y_n = X_n.*(1./(1+j*n*omega_0*RC(k)));% 	Plot magnitude of X_n and Y_n	if k == 1	subplot(N_RC+1,1,1),stem(n*f0, abs(X_n)), xlabel('n*f0'), ylabel('magnitude'),...	title('Input spectrum'),axis([-n_max*f0 n_max*f0 0 1])	end	subplot(N_RC+1,1,k+1),stem(n*f0, abs(Y_n)), xlabel('n*f0'), ylabel('magnitude'),...	title(['Output spectrum for RC = ', num2str(RC(k)), ' seconds']),	axis([-n_max*f0 n_max*f0 0 1]),hold on	subplot(N_RC+1,1,k+1), plot(f,abs(H),'--')end

⌨️ 快捷键说明

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