資源簡介
用C#實現的FFT和IFFT類,方便初學者進行學習,也可直接在代碼里使用

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
namespace?FFT
{
????///?
????///?復數類
????///?
????class?Complex
????{
????????///?
????????///?默認構造函數
????????///?
????????public?Complex()
????????????:?this(0?0)
????????{
????????}
????????///?
????????///?只有實部的構造函數
????????///?
????????///?實部
????????public?Complex(double?real)
????????????:?this(real?0)?{?}
????????///?
????????///?由實部和虛部構造
????????///?
????????///?實部
????????///?虛部
????????public?Complex(double?real?double?image)
????????{
????????????this.real?=?real;
????????????this.image?=?image;
????????}
????????private?double?real;
????????///?
????????///?復數的實部
????????///?
????????public?double?Real
????????{
????????????get?{?return?real;?}
????????????set?{?real?=?value;?}
????????}
????????private?double?image;
????????///?
????????///?復數的虛部
????????///?
????????public?double?Image
????????{
????????????get?{?return?image;?}
????????????set?{?image?=?value;?}
????????}
????????///重載加法
????????public?static?Complex?operator?+(Complex?c1?Complex?c2)
????????{
????????????return?new?Complex(c1.real?+?c2.real?c1.image?+?c2.image);
????????}
????????///重載減法
????????public?static?Complex?operator?-(Complex?c1?Complex?c2)
????????{
????????????return?new?Complex(c1.real?-?c2.real?c1.image?-?c2.image);
????????}
????????///重載乘法
????????public?static?Complex?operator?*(Complex?c1?Complex?c2)
????????{
????????????return?new?Complex(c1.real?*?c2.real?-?c1.image?*?c2.image?c1.image?*?c2.real?+?c1.real?*?c2.image);
????????}
????????///?
????????///?求復數的模
????????///?
????????///?模
????????public?double?ToModul()
????????{
????????????return?Math.Sqrt(real?*?real?+?image?*?image);
????????}
????????///?
????????///?重載ToString方法
????????///?
????????///?打印字符串
????????public?override?string?ToString()
????????{
????????????if?(Real?==?0?&&?Image?==?0)
????????????{
????????????????return?string.Format(“{0}“?0);
????????????}
????????????if?(Real?==?0?&&?(Image?!=?1?&&?Image?!=?-1))
????????????{
????????????????return?string.Format(“{0}?i“?Image);
????????????}
????????????if?(Image?==?0)
????????????{
????????????????return?string.Format(“{0}“?Real);
????????????}
????????????if?(Image?==?1)
????????????{
????????????????return?string.Format(“i“);
????????????}
????????????if?(Image?==?-1)
????????????{
????????????????return?string.Format(“-?i“);
????????????}
????????????if?(Image?0)
????????????{
????????????????return?string.Format(“{0}?-?{1}?i“?Real?-Image);
????????????}
????????????return?string.Format(“{0}?+?{1}?i
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????187??2014-12-02?20:29??FFT\FFT\App.config
?????文件???????8192??2014-12-02?21:54??FFT\FFT\bin\Debug\FFT.exe
?????文件????????187??2014-12-02?20:29??FFT\FFT\bin\Debug\FFT.exe.config
?????文件??????24064??2014-12-02?21:54??FFT\FFT\bin\Debug\FFT.pdb
?????文件??????22984??2014-12-02?21:58??FFT\FFT\bin\Debug\FFT.vshost.exe
?????文件????????187??2014-12-02?20:29??FFT\FFT\bin\Debug\FFT.vshost.exe.config
?????文件???????3180??2014-12-02?20:36??FFT\FFT\Complex.cs
?????文件???????2624??2014-12-02?21:15??FFT\FFT\FFT.csproj
?????文件???????1799??2014-12-02?21:44??FFT\FFT\FFTMain.cs
?????文件???????4502??2014-12-02?21:38??FFT\FFT\FFT_IFFT.cs
?????文件???????6442??2014-12-02?21:15??FFT\FFT\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????217??2014-12-02?21:58??FFT\FFT\obj\Debug\FFT.csproj.FileListAbsolute.txt
?????文件???????8192??2014-12-02?21:54??FFT\FFT\obj\Debug\FFT.exe
?????文件??????24064??2014-12-02?21:54??FFT\FFT\obj\Debug\FFT.pdb
?????文件??????????0??2014-12-02?20:29??FFT\FFT\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2014-12-02?20:29??FFT\FFT\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2014-12-02?20:29??FFT\FFT\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件???????1326??2014-12-02?20:29??FFT\FFT\Properties\AssemblyInfo.cs
?????文件???????1377??2014-12-02?21:46??FFT\FFT.sln
????..A..H.?????39936??2014-12-02?22:52??FFT\FFT.v11.suo
?????文件????????187??2014-12-02?21:45??FFT\FFT_Form\App.config
?????文件????????523??2014-12-02?21:46??FFT\FFT_Form\AppMain.cs
?????文件???????9728??2014-12-02?22:37??FFT\FFT_Form\bin\Debug\FFT_Form.exe
?????文件????????187??2014-12-02?21:45??FFT\FFT_Form\bin\Debug\FFT_Form.exe.config
?????文件??????24064??2014-12-02?22:37??FFT\FFT_Form\bin\Debug\FFT_Form.pdb
?????文件??????22984??2014-12-02?22:37??FFT\FFT_Form\bin\Debug\FFT_Form.vshost.exe
?????文件????????187??2014-12-02?21:45??FFT\FFT_Form\bin\Debug\FFT_Form.vshost.exe.config
?????文件???????3810??2014-12-02?21:54??FFT\FFT_Form\FFT_Form.csproj
?????文件???????2736??2014-12-02?22:52??FFT\FFT_Form\MainForm.cs
?????文件???????5163??2014-12-02?22:02??FFT\FFT_Form\MainForm.Designer.cs
............此處省略37個文件信息
- 上一篇:C#服裝倉庫管理系統
- 下一篇:新生報到管理系統
評論
共有 條評論