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

📄 c3ex6.m

📁 为了更好的便于增加交流
💻 M
字号:
%	Program to give partial complex exponential Fourier sums of an %	half rectified sine wave of unit amplitude%n_max = input('Enter vector of highest harmonic values desired (even) ');N = length(n_max);t = 0:.005:1;omega_0 = 2*pi;for k = 1:N	n = [];	n = [-n_max(k):n_max(k)];	L_n = length(n);	X_n = zeros(1, L_n);		% Form vector of Fourier sine-coefficients; all	X_n((L_n+1)/2+1) = -0.25*j;	% odd-order terms are zero except X(1) and X(-1) 	X_n((L_n+1)/2-1) = 0.25*j;	% so define coefficient array as a zero array and	for i = 1:2:L_n			% then fill in nonzero values		X_n(i)=1/(pi*(1-n(i)^2));% Form vector of Fourier sine-coefficients	end	x = X_n*exp(j*omega_0*n'*t);	% Rows of exponential matrix are versus time; 					% columns are versus n; matrix multiply sums over n% 	Plot real part of x to get rid of small imaginary part due to computational error	subplot(N,1,k),plot(t, real(x)), xlabel('t'), ylabel('partial sum'),...	axis([0 1 -0.5 1.5]), text(.05,-.25, ['max. har. = ', num2str(n_max(k))])end

⌨️ 快捷键说明

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