📄 c3ex4.m
字号:
% Program to give partial Fourier sums of an % odd square wave of unit amplitude%n_max = input('Enter vector of highest harmonic values desired (odd) ');N = length(n_max);t = 0:.002:1;omega_0 = 2*pi;for k = 1:N n = []; n = [1:2:n_max(k)]; b_n = 4./(pi*n); % Form vector of Fourier sine-coefficients x = b_n*sin(omega_0*n'*t); % Rows of sine matrix are versus time; columns are versus n, % so matrix multiply sums over n subplot(N,1,k),plot(t, x), xlabel('t'), ylabel('partial sum'),... axis([0 1 -1.5 1.5]), text(.05,-.5, ['max. har. = ', num2str(n_max(k))])end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -