欢迎来到天天文库
浏览记录
ID:49605200
大小:63.01 KB
页数:18页
时间:2020-03-02
《傅立叶变换delphi源码.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、傅立叶变换Delphi源码unitcplx;interfacetypePReal=^TReal;TReal=extended;PComplex=^TComplex;TComplex=recordr:TReal;i:TReal;end; functionMakeComplex(x,y:TReal):TComplex;functionSum(x,y:TComplex):TComplex;functionDifference(x,y:TComplex):TComplex;functionProduct(x,y:TComplex):T
2、Complex;functionTimesReal(x:TComplex;y:TReal):TComplex;functionPlusReal(x:TComplex;y:TReal):TComplex;functionEiT(t:TReal):TComplex;functionComplexToStr(x:TComplex):string;functionAbsSquared(x:TComplex):TReal;implementationusesSysUtils;functionMakeComplex(x,y:TReal):
3、TComplex;beginwithresultdobeginr:=x;i:=y;end;end;functionSum(x,y:TComplex):TComplex;beginwithresultdobeginr:=x.r+y.r;i:=x.i+y.i;end;end;functionDifference(x,y:TComplex):TComplex;beginwithresultdobeginr:=x.r-y.r;i:=x.i-y.i;end;end;functionEiT(t:TReal):TComplex;beginw
4、ithresultdobeginr:=cos(t);i:=sin(t);end;end; functionProduct(x,y:TComplex):TComplex;beginwithresultdobeginr:=x.r*y.r-x.i*y.i;i:=x.r*y.i+x.i*y.r;end;end;functionTimesReal(x:TComplex;y:TReal):TComplex;beginwithresultdobeginr:=x.r*y;i:=x.i*y;end;end;functionPlusReal(x:
5、TComplex;y:TReal):TComplex;beginwithresultdobeginr:=x.r+y;i:=x.i;end;end;functionComplexToStr(x:TComplex):string;beginresult:=FloatToStr(x.r)+'+'+FloatToStr(x.i)+'i';end;functionAbsSquared(x:TComplex):TReal;beginresult:=x.r*x.r+x.i*x.i;end;end. ---------------------
6、----------------------------------------------------------- -------------------------------------------------------------------------------- unitcplxfft1;interfaceusesCplx;typePScalar=^TScalar;TScalar=TComplex;{Makingconversiontorealversioneasier}PScalars=^TScalars
7、;TScalars=array[0..High(integer)divSizeOf(TScalar)-1]ofTScalar;constTrigTableDepth:word=0;TrigTable:PScalars=nil;procedureInitTrigTable(Depth:word);procedureFFT(Depth:word;Src:PScalars;Dest:PScalars);{REQUIRESallocating(integer(1)shlDepth)*SizeOf(TScalar)bytesforSrc
8、andDestbeforecall!}implementationprocedureDoFFT(Depth:word;Src:PScalars;SrcSpacing:word;Dest:PScalars);{therecursivepartcalledbyFFTwhenrea
此文档下载收益归作者所有