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

📄 fsfind.m

📁 信号实验常用的simulink模型和mfile,可直接在matlan下运行。
💻 M
字号:
function [Fn,nwo,f,t]=fsfind(fun,T,N,P)
%FSFIND	Find Fourier Series Approximation.
%	Fn=FSFIND(FUN,T,N) computes the Complex Exponential
%	Fourier Series of a signal described by the function 'FUN'.
%	FUN is the character string name of a user created M-file function.
%	The function is called as f=FUN(t) where t is a vector over
%	the range 0<=t<=T.
%
%	The FFT is used. Choose sufficient harmonics to minimize aliasing.
%
%	T is the period of the function. N is the number of harmonics.
%	Fn is the vector of FS coefficients.
%
%	[Fn,nWo,f,t]=FSFIND(FUN,T,N) returns the frenquencies associated
%	with Fn in nWo and returns values of the function FUN
%	in f evaluted at the pointd int t over the range 0<=t<=T.
%
%	FSFIND(FUN,T,N,P) passes the data in P to function FUN as
%	f=FUN(t,p). This allows parameters to be passed to FUN.
n=2*N;
t=linspace(0,T,n+1);
if nargin==3
	f=feval(fun,t);
else
	f=feval(fun,t,P);
end
Fn=fft(f(1:n));
Fn=[0 conj(Fn(N:-1:2)) Fn(1:N) 0]/n;
nwo=2*pi/T*(-N:N);

⌨️ 快捷键说明

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