分裂基快速傅里叶变换 反变换, Split Radix Fast Fourier Transform

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using static System.Net.WebRequestMethods;

namespace Split_Radix_FFT
{
    public partial class Split_Radix_FFTForm : Form
    {
        public Split_Radix_FFTForm()
        {
            InitializeComponent();
        }

        /************************************
        * x(i) = Qⁱ, i= 0,.....n-1
        * DFT  X(k) = (1-Qⁿ)/(1-QWᵏ)  k= 0,......n-1, W = e^(-j2π/n)
        * Q = 0.9 + j 0.3 
        * n=32,
        ************************************/
        private void btTransform_Click(object sender, EventArgs e)
        {
            int i, j, n;
            double a1, a2, c, c1, c2, d1, d2, q1, q2, w, w1, w2;
            double[] x = new double[64];
            double[] y = new double[64];
            double[] a = new double[64];
            double[] b = new double[64];
            n = 64;
            a1 = 0.9;
            a2 = 0.3;
            x[0] = 1.0;
            y[0] = 0.0;
            for (i = 1; i < n; i++)
            {
                x[i] = a1 * x[i - 1] - a2 * y[i - 1];
                y[i] = a2 * x[i - 1] + a1 * y[i - 1];
            }
            rbPointData.AppendText("\n Complex Input Sequence \n");
            for (i = 0; i < n / 2; i++)
            {
                for (j = 0; j < 2; j++)
                    rbPointData.AppendText(x[2 * i + j].ToString("f6") + "   \t"+ "J "+ y[2 * i + j].ToString("f6") + "\t");               
                    rbPointData.AppendText("\n");
            }
            for(i=0; i < n  ;i++)
            {
                this.chart1.Series[0].Points.AddXY(x[i], y[i]);
            }
            q1 = x[n - 1];
            q2 = y[n - 1];
            for (i = 0; i < n; i++)
            {
                w = 6.28318530718 / n * i;
                w1 = Math.Cos(w);
                w2 = -Math.Sin(w);
                c1 = 1.0 - a1 * w1 + a2 * w2;
                c2 = a1 * w2 + a2 * w1;
                c = c1 * c1 + c2 * c2;
                d1 = 1.0 - a1 * q1 + a2 * q2;
                d2 = a1 * q2 + a2 * q1;
                a[i] = (c1 * d1 + c2 * d2) / c;
                b[i] = (c2 * d1 - c1 * d2) / c;
            }            rbTransformData.AppendText("\n Theoretical Discrete Fourier Transform  \n");
            for (i = 0; i < n / 2; i++)
            {
                for (j = 0; j < 2; j++)
                    rbTransformData.AppendText(a[2 * i + j].ToString("F6") + "   \t"+"J " + b[2 * i + j].ToString("f6") + "\t");
                    rbTransformData.AppendText("\n");
            }
            for (i = 0; i < n; i++)
            {
                this.chart2.Series[0].Points.AddXY(a[i], b[i]);
            }

            srfft(x, y, n);
            rbPointData.AppendText("\n Split Radix Fast Fourier Transform:\n");
            for (i = 0; i < n / 2; i++)
            {
                for (j = 0; j < 2; j++)
                    rbPointData.AppendText(x[2 * i + j].ToString("f6") + "   \t" + "J " + y[2 * i + j].ToString("f6") + "\t");
                rbPointData.AppendText("\n");
            }
            for (i = 0; i < n; i++)
            {

                this.chart1.Series[1].Points.AddXY(x[i], y[i]);
            }
            isrfft(x, y, n);
            rbTransformData.AppendText("\n Inverse Radix4 Fast Fourier Transform\n");
            for (i = 0; i < n / 2; i++)
            {
                for (j = 0; j < 2; j++)
                    rbTransformData.AppendText(x[2 * i + j].ToString("f6") + "   \t" + "J " + y[2 * i + j].ToString("f6") + "\t");
                rbTransformData.AppendText("\n");
            }
            for (i = 0; i < n; i++)
            {
                this.chart2.Series[1].Points.AddXY(x[i], y[i]);
            }
        }
    }
}

 分裂基快速傅里叶变换反变换,SplitRadixFastFourierTransform资源-CSDN文库

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值