C# と VB.NET の質問掲示板

わんくま同盟

ASP.NET、C++/CLI、Java 何でもどうぞ

C# と VB.NET の入門サイト


■102875 / )  Re[3]: このエラーを解消したいです。
□投稿者/ みか (2回)-(2024/01/19(Fri) 23:21:12)
2024/01/20(Sat) 22:15:44 編集(投稿者)
No102869 (くま さん) に返信
■No102870 (魔界の仮面弁士 さん) に返信

あちこちから引っ張って来てつくりました。
何も分かっていません。
身の程知らずですみません。

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim y() As Double            'データが入る配列
        Dim N As Integer = 5
        Dim M As Integer = 2
        Dim result As Double
        result = SGFilter(y(), N, M)
    End Sub

    Private Function SGFilter(ByVal y() As Double, ByVal N As Integer, ByVal M As Integer) As Double()
        Dim i As Integer, j As Integer, k As Integer
        Dim w(0 To N, 0 To M) As Double
        Dim sum As Double
        Dim y2() As Double

        ReDim y2(0 To UBound(y))

        For i = 0 To UBound(y)
            sum = 0
            For j = -N To N
                For k = 0 To M
                    w(N + j, k) = ((j + k) ^ (2 * M))
                Next k
                sum = sum + w(N + j, 0)
            Next j
            For j = -N To N
                For k = 0 To M
                    w(N + j, k) = w(N + j, k) / sum
                Next k
            Next j
            For j = -N To N
                sum = 0
                For k = 0 To M
                    sum = sum + w(N + j, k) * y(i + j)
                Next k
                y2(i) = y2(i) + sum
            Next j
        Next i
        SGFilter = y2
    End Function


返信 編集キー/


管理者用

- Child Tree -