sqmmf.m

来自「Although most of the health problems rel」· M 代码 · 共 18 行

M
18
字号
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  sqmmf.m - Generates a normalized square wave mmf and its
%            associated Fourier spectrum.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear; clf;
% Construct & plot square wave.
n=1024; x=ones(1,n); x(n/2:n)=-x(n/2:n);ang=linspace(0,360,n);
subplot(2,1,1); axis tight; plot(0,1.1,0,-1.1,ang,x); grid;
title('Normalized air gap square wave mmf');
xlabel('Angular position, elect. deg.'); ylabel('mmf/Ni - pu');
% Determine Fourier coefficients & plot in percent.
x=abs(fft(x)); x=x/max(x)*100;
subplot(2,1,2); axis; plot([0:25],x(1:26)); grid;
title('Fourier coefficients of square wave mmf');
xlabel('Harmonic number'); ylabel('Harmonic magnitude, %');

⌨️ 快捷键说明

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