fsharm.m
来自「精通MATLAB-综合辅导与指南(附例程)」· M 代码 · 共 27 行
M
27 行
function [h,ih]=fsharm(kn,n)%FSHARM Fourier Series Harmonic Component Selection.% FSHARM(Kn,N) returns the (N)th harmonic component of the% complex exponential FS given by Kn.% FSHARM(Kn) returns the DC component.% [H,i]=FSHARM(Kn,N) returns the index of the selected% harmonic H in i.% D.C. Hanselman, University of Maine, Orono, ME 04469% 1/12/95% Copyright (c) 1996 by Prentice-Hall, Inc. m=length(kn);if nargin==1,n=0;endif rem(m,2), % kn has an odd number of elements ih=(m+1)/2+n; % index of desired harmonic if (ih>m)|(ih<1) h=0;ih=[]; % desired harmonic is outside range else h=kn(ih); % index is fine if n==0,h=real(h);end %DC component is real only! endelse, % x has an even number of harmonics h=[];ih=[]; error('Kn must have an odd number of elements')end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?