VB常用数值算法集 内含有解线性代数方程组

源代码在线查看: realft.txt

软件大小: 1879 K
上传用户: whyzhao
关键词: 数值算法 解线性 方程
下载地址: 免注册下载 普通下载 VIP

相关代码

				Sub REALFT(DATA(), N, ISIGN)
				    THETA = 6.28318530717959 / 2# / N
				    C1 = 0.5
				    If ISIGN = 1 Then
				        C2 = -0.5
				        Call FOUR1(DATA(), N, 1)
				    Else
				        C2 = 0.5
				        THETA = -THETA
				    End If
				    WPR = -2# * Sin(0.5 * THETA) ^ 2
				    WPI = Sin(THETA)
				    WR = 1# + WPR
				    WI = WPI
				    N2P3 = 2 * N + 3
				    For I = 2 To N / 2 + 1
				        I1 = 2 * I - 1
				        I2 = I1 + 1
				        I3 = N2P3 - I2
				        I4 = I3 + 1
				        WRS = CSng(WR)
				        WIS = CSng(WI)
				        H1R = C1 * (DATA(I1) + DATA(I3))
				        H1I = C1 * (DATA(I2) - DATA(I4))
				        H2R = -C2 * (DATA(I2) + DATA(I4))
				        H2I = C2 * (DATA(I1) - DATA(I3))
				        DATA(I1) = H1R + WRS * H2R - WIS * H2I
				        DATA(I2) = H1I + WRS * H2I + WIS * H2R
				        DATA(I3) = H1R - WRS * H2R + WIS * H2I
				        DATA(I4) = -H1I + WRS * H2I + WIS * H2R
				        WTEMP = WR
				        WR = WR * WPR - WI * WRI + WR
				        WI = WI * WPR + WTEMP * WPI + WI
				    Next I
				    If ISIGN = 1 Then
				        H1R = DATA(1)
				        DATA(1) = H1R + DATA(2)
				        DATA(2) = H1R - DATA(2)
				    Else
				        H1R = DATA(1)
				        DATA(1) = C1 * (H1R + DATA(2))
				        DATA(2) = C1 * (H1R - DATA(2))
				        Call FOUR1(DATA(), N, -1)
				    End If
				End Sub			

相关资源