关于传输线矩阵算法的问题 [英] A problem regarding a Transmission Line Matrix algorithm

查看:86
本文介绍了关于传输线矩阵算法的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,在我提交代码之前,这需要一些解释。我实现的算法称为 TLM [ ^ ]简称。



为了构建算法,我注意到每个小区或节点可以与其4个邻居进行通信,称为北,南,西和东,以获得认可。在每个方向上,它可以发送压力系数并接收邻居的压力系数,因此每个节点将具有8个可能的连接,这些连接彼此独立地工作。



除了连接之外,每个节点的每个点都有一个压力,它只是入射波的总和。



我遇到的问题是,似乎源的点从矩阵的中心移动到点0,0,我无法弄清楚为什么。 (看起来有多普勒效应)。



下面的代码相当长(appologies)但是IT代码是一个完整的代码,除了多普勒的东西。我不知道为什么我应该按原样工作......任何人都可以看到我的错误吗?



在XAML:

 <  窗口    x:Class   =  MainWindow < span class =code-attribute> 

< span class =code-attribute> xmlns = http://schemas.microsoft.com/winfx/2006/xaml/presentation

xmlns:x = http://schemas.microsoft.com/winfx/2006/xaml\"

标题 = MainWindow 高度 = 350 宽度 < span class =code-keyword> = 525 >
< StackPanel >
< 按钮 名称 = btnStart < span class =code-keyword>> 开始< /按钮 >
< Border < span class =code-attribute> BorderThickness = 2 BorderBrush = blue Horizo​​ntalAlignment = Ce nter >
< 画布 名称 = cnvTLM 背景 = 白色 宽度 = 300 高度 = < span class =code-keyword> 300 > < / Canvas >
< / Border >
< / StackPanel >
< / Window >





完整的VB代码:

 导入 System.Windows.Threading 

MainWindow

私有维度作为 整数 = 200
私人 IncommingEast(尺寸,尺寸),InncommingNorth(尺寸,尺寸),IncommingWest(尺寸,尺寸),IncommingSouth(尺寸,尺寸) ,ScatteredEast(尺寸,尺寸),ScatteredNorth(尺寸,尺寸),ScatteredWest(尺寸,尺寸),ScatteredSouth(尺寸,尺寸) As Double
私人 CurrentPressure(尺寸,尺寸)作为 Double

Dim SimulationTimer As DispatcherTimer

私有 Sub Window_Loaded(sender As System。 Object ,e As System.Windows.RoutedEventArgs)句柄 MyBase .Loaded
FillInColorList()

SimulationTimer = DispatcherTimer()
AddHandler SimulationTimer.Tick, AddressOf SimulationTimer_Tick
SimulationTimer.Interval = TimeSpan( 0 0 0 0 100

结束 Sub
Dim TT As Double = 1

私有 Sub SimulationTimer_Tick( ByVal 发​​件人作为 对象 ByVal e As EventArgs)
' 更新显示当前第二个的标签
对于 x As 整数 = 1 尺寸 - 2
对于 y 作为 整数 = 1 尺寸 - 2
如果 x = CInt (维度/ 2 y = CInt (维度/ 2 然后
IncommingEast(x,y)= 30 * Math.Sin( 2 * Math.PI * TT / 10 )+ IncommingEast(x,y)
IncommingWest(x,y)= 30 * Math.Sin( 2 * Math.PI * TT / 10 )+ IncommingWest(x,y)
IncommingSouth(x,y)= 30 * Math.Sin( 2 * Math.PI * TT / 10 )+ IncommingSouth(x,y)
InncommingNorth(x,y)= 30 * Math.Sin( 2 * Math.PI * TT / 10 )+ InncommingNorth(x,y)
结束 如果

ScatteredNorth(x,y)= 0 5 *(+ IncommingEast(x,y) - In ncommingNorth(x,y)+ IncommingWest(x,y)+ IncommingSouth(x,y))
ScatteredEast(x,y)= 0 5 *(-IncommingEast(x,y)+ InncommingNorth(x,y)+ IncommingWest(x,y)+ IncommingSouth(x,y))
ScatteredWest( x,y)= 0 5 *(+ IncommingEast(x,y)+ InncommingNorth(x, y) - IncommingWest(x,y)+ IncommingSouth(x,y))
ScatteredSouth(x,y)= 0 5 *(+ IncommingEast(x,y)+ InncommingNorth(x,y)+ IncommingWest(x,y) - IncommingSouth(x,y))

IncommingEast( x,y)= ScatteredWest(x + 1 ,y)
InncommingNorth(x,y)= ScatteredSouth(x,y + 1
IncommingWest(x,y)= ScatteredEast(x - 1 ,y)
IncommingSouth(x,y)= ScatteredNorth(x,y - 1

CurrentPressure(x,y)=( 0 5 *(ScatteredEast(x,y)+ ScatteredNorth(x,y)+ ScatteredWest(x,y)+ ScatteredSouth (x,y)))
下一步

下一页
TT + = 1
Dim img 正如 ImageBrush
img.ImageSource = CreateBitmap(CurrentPressure,Dimensions,Dimensions)
cnvTLM.Background = img

' 强制CommandManager引发RequerySuggested事件
CommandManager.InvalidateRequerySuggested( )
结束 Sub

私有 Sub btnStart_Click (发件人作为系统。对象,e As System.Windows.RoutedEventArgs)句柄 btnStart.Click
如果 SimulationTimer.IsEnabled 然后
SimulationTimer。停止()
其他
SimulationTimer.Start()
结束 如果

结束 Sub

私有 Sub FillInColorList()

Dim f As SmoothColorGenerator
SmoothColorList = f.ColorList
结束 Sub

Dim SmoothColorList As 列表( 颜色)

私有 功能 CreateBitmap( ByVal IntegerArray(,) As Double ByVal 宽度作为 整数 ByVal 高度作为 整数可选 ByVal DistinctC olorSettings 作为 布尔 = 错误 As BitmapSource
Dim buffer As < span class =code-keyword>新列表( 字节

Dim ColList As List( Of 颜色)
如果 DistinctColorSettings 那么
ColList = SmoothColorList
其他
ColList = SmoothColorList
结束 如果

Dim B_MASK As 整数 = 255
Dim G_MASK As 整数 = 255 << 8
Dim R_MASK As 整数 = 255 << 16

对于 x As 整数 = 0 IntegerArray.GetLength( 1 ) - 1
对于 y As 整数 = 0 IntegerArray.GetLength( 0 ) - 1
Dim k 作为 整数 = 0
k =(IntegerArray(x,y)/ 2 + 125

B_MASK = ColList(k).B $​​ b $ b G_MASK = ColList(k).G
R_MASK = ColList(k).R


buffer.Add(B_MASK)
buffer.Add(G_MASK)
buffer.Add(R_MASK)
buffer.Add( 255

下一步
下一步

Dim dpiX As Double = 96D
Dim dpiY 作为 Double = 96D
Dim pixelFormat = PixelFormats.Pbgra32
Dim bytesPerPixel = Math.Truncate(((pixelFormat.BitsPerPixel + 7 )/ 8 ))
Dim strid e = bytesPerPixel * IntegerArray.GetLength( 0

返回 BitmapSource.Create (IntegerArray.GetLength( 0 ) - 1 ,IntegerArray.GetLength( 1 ) - 1 ,dpiX,dpiY,
pixelFormat,没什么 ,buffer.ToArray,stride)'
结束 功能


私有 函数 CreateBitmap( ByVal IntegerArray(,) As 整数 ByVal 宽度 整数 ByVal 高度作为 整数可选 ByVal DistinctColorSettings As 布尔 = 错误 As BitmapSource
Dim buffer As List( of Byte

Dim ColList 作为列表( 颜色)
如果 DistinctColorSettings 那么
ColList = SmoothColorList
Else
ColList = SmoothColorList
结束 如果

对于 i 作为 整数 = 0 宽度 - 1
< span class =code-keyword>对于
j 作为 整数 = 0 高度 - 1
Dim k 作为 整数 = IntegerArray(i,j)

buffer.Add(ColList(k).R)
buffer.Add(ColList(k).G)
buffer.Add(ColList(k).B)
buffer.Add( 255

下一步
下一页

Dim dpiX As Double = 96D
Dim dpiY 作为 Double = 96D
Dim pixelFormat = PixelFormats.Pbgra32
Dim bytesPerPixel = Math.Truncate(((pixelFormat.BitsPerPixel + 7 )/ 8 ))
Dim stride = bytesPerPixel * Width

返回 BitmapSource.Create(宽度,高度) ,dpiX,dpiY,
pixelFormat, Nothing ,buffer.ToArray,stride)'
结束 功能



结束

#RegionGenerateColorListClasses


公共 SmoothColorGenerator

Sub ()

GradientStop.Add(Brushes.Red)
GradientStop.Add(Brushes.White)
GradientStop.Add(Brushes.Blue)

对于 i 作为 整数 = 0 GradientStop.Count - 2
GetGradients(GradientSt op(i)。Color,GradientStop(i + 1 )。颜色, 125
下一步

结束 Sub

私有 pGradientStop 作为 列表( SolidColorBrush)
公共 属性 GradientStop()作为列表( SolidColorBrush)
获取
返回 pGradientStop
结束 获取
设置 ByVal As 列表( SolidColorBrush))
pGradientStop = value
结束 < span class =code-keyword>设置
结束 物业

私有 pColorlist 作为 列表( 颜色)
公共 属性 ColorList()作为列表( 颜色)
获取
返回 pColorlist
结束 获取
设置 ByVal 作为列表( 颜色))
pColorlist = value
结束 设置
结束 属性

公共 Sub GetGradients( ByVal 开始作为颜色, ByVal 结束作为颜色, ByVal 步骤作为 整数
Dim stepA 作为 整数 = Math.Truncate(( CInt (ends.A) - CInt (starts.A ))/( CInt (步骤) - 1 ))
Dim stepR As 整数 = Math.Truncate(( CInt (ends.R) - CInt (starts.R))/( CInt (步骤) - 1 ) )
Dim stepG As 整数 = Math.Truncate(( CInt (ends.G) - CInt (starts.G))/ ( CInt (步骤) - 1 ))
Dim stepB As Integer = Math.Truncate(( CInt (ends.B) - CInt (starts.B))/( CInt (步骤) - 1 ))

对于 i 作为 整数 = 0 步骤 - 1

ColorList.Add(Color.FromArgb( CInt (starts.A)+ CInt (stepA)* CInt (i),
CInt (starts.R)+ CInt (stepR)* CInt (i),
CInt (starts.G)+ CInt (步骤G)* CInt (i),
CInt (starts.B)+ CInt (stepB)* CInt (i)))
下一步

结束 Sub
结束


#End Region

解决方案
确定。我发现了什么是错的,它的事件顺序。



首先计算所有点的所有散射,然后传播声压。或者在代码中:

 私人  Sub  SimulationTimer_Tick( ByVal  sender  As   Object ,< span class =code-keyword> ByVal  e  As  EventArgs)
' 更新显示当前第二个的标签
对于 x 作为 整数 = 1 维度 - 2
对于 y 正如 整数 = 1 尺寸 - 2
如果 x = CInt (尺寸/ 2 y = CInt (尺寸/ 2 然后
IncommingEast(x,y)= 30 * Math.Sin( 2 * Math.PI * TT / 10 )+ IncommingEast(x,y)
IncommingWest(x ,y)= 30 * Math.Sin( 2 * Math.PI * TT / 10 )+ IncommingWest(x,y)
IncommingSouth(x,y)= 30 * Math.Sin( 2 * Math.PI * TT / 10 )+ IncommingSouth(x,y)
InncommingNorth (x,y)= 30 * Math.Sin( 2 * Math.PI * TT / 10 )+ InncommingNorth(x,y)
结束 如果

ScatteredNorth(x,y)= 0 5 *(+ IncommingEast(x,y) - InncommingNorth(x,y)+ IncommingWest(x,y)+ IncommingSouth(x,y) )
ScatteredEast(x,y)= 0 5 *(-IncommingEast(x, y) + InncommingNorth(x, y) + IncommingWest(x, y) + IncommingSouth(x, y))
ScatteredWest(x, y) = 0 .5 * (+IncommingEast(x, y) + InncommingNorth(x, y) - IncommingWest(x, y) + IncommingSouth(x, y)) $b$ b ScatteredSouth(x, y) = 0.5 * (+IncommingEast(x, y) + InncommingNorth (x, y) + IncommingWest(x, y) - IncommingSouth(x, y) )

Next
Next

For x As Integer = 1 To Dimensions - 2
For y As Integer = 1 To Dimensions - 2

IncommingEast(x, y) = ScatteredWest(x + 1, y)
InncommingNorth(x, y) = ScatteredSouth(x, y + 1)
IncommingWest(x, y) = ScatteredEast(x - 1, y)
IncommingSouth(x, y) = ScatteredNorth(x, y - 1)

CurrentPressure(x, y) = (0.5 * (ScatteredEast(x, y) + ScatteredNorth(x, y) + ScatteredWest(x, y) + ScatteredSouth(x, y)))
Next

Next

TT += 1
Dim img As New ImageBrush
img.ImageSource = CreateBitmap(CurrentPressure, Dimensions, Dimensions)
cnvTLM.Background = img

' Forcing the CommandManager to raise the RequerySuggested event
CommandManager.InvalidateRequerySuggested()
End Sub


Ok, this is going to take some explaining before I present the code. The algorithm Im implementing is called TLM [^]for short.

To construct the algorithm I have noticed that each cell or node, can communicate with 4 of its neighbors, called North, South, West and East for conviniance. In each of the directions it can send a pressure coeficcient and recieve a pressure coefficient for the neighbors, so each node will have 8 possible connections, that works sort of independent of each other.

In addition to the connections, each node will have a pressure at each point that is just the sum of the incoming waves.

The problem Im having is that it seems that the point of the source is moving to point 0,0 from the center of the matrix, and I cant figure out why. (Looks like there is a Doppler effect going on).

The code below is rather long (appologies) but ITs a complete functioning code, except for the doppler thing. I cant figur out why I dosnt work as it should... Can anybody see my mistake?

In XAML:

<Window x:Class="MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <Button Name="btnStart">Start</Button>
        <Border BorderThickness="2" BorderBrush="blue" HorizontalAlignment="Center" >
        <Canvas Name="cnvTLM" Background="White" Width="300" Height="300"></Canvas>
        </Border>
    </StackPanel>
</Window>



And the complete VB code:

Imports System.Windows.Threading

Class MainWindow

    Private Dimensions As Integer = 200
    Private IncommingEast(Dimensions, Dimensions), InncommingNorth(Dimensions, Dimensions), IncommingWest(Dimensions, Dimensions), IncommingSouth(Dimensions, Dimensions), ScatteredEast(Dimensions, Dimensions), ScatteredNorth(Dimensions, Dimensions), ScatteredWest(Dimensions, Dimensions), ScatteredSouth(Dimensions, Dimensions) As Double
    Private CurrentPressure(Dimensions, Dimensions) As Double

    Dim SimulationTimer As DispatcherTimer

    Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        FillInColorList()

        SimulationTimer = New DispatcherTimer()
        AddHandler SimulationTimer.Tick, AddressOf SimulationTimer_Tick
        SimulationTimer.Interval = New TimeSpan(0, 0, 0, 0, 100)

    End Sub
    Dim TT As Double = 1

    Private Sub SimulationTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
        ' Updating the Label which displays the current second
        For x As Integer = 1 To Dimensions - 2
            For y As Integer = 1 To Dimensions - 2
                If x = CInt(Dimensions / 2) And y = CInt(Dimensions / 2) Then
                    IncommingEast(x, y) = 30 * Math.Sin(2 * Math.PI * TT / 10) + IncommingEast(x, y)
                    IncommingWest(x, y) = 30 * Math.Sin(2 * Math.PI * TT / 10) + IncommingWest(x, y)
                    IncommingSouth(x, y) = 30 * Math.Sin(2 * Math.PI * TT / 10) + IncommingSouth(x, y)
                    InncommingNorth(x, y) = 30 * Math.Sin(2 * Math.PI * TT / 10) + InncommingNorth(x, y)
                End If

                ScatteredNorth(x, y) = 0.5 * (+IncommingEast(x, y) - InncommingNorth(x, y) + IncommingWest(x, y) + IncommingSouth(x, y))
                ScatteredEast(x, y) = 0.5 * (-IncommingEast(x, y) + InncommingNorth(x, y) + IncommingWest(x, y) + IncommingSouth(x, y))
                ScatteredWest(x, y) = 0.5 * (+IncommingEast(x, y) + InncommingNorth(x, y) - IncommingWest(x, y) + IncommingSouth(x, y))
                ScatteredSouth(x, y) = 0.5 * (+IncommingEast(x, y) + InncommingNorth(x, y) + IncommingWest(x, y) - IncommingSouth(x, y))

                IncommingEast(x, y) = ScatteredWest(x + 1, y)
                InncommingNorth(x, y) = ScatteredSouth(x, y + 1)
                IncommingWest(x, y) = ScatteredEast(x - 1, y)
                IncommingSouth(x, y) = ScatteredNorth(x, y - 1)

                CurrentPressure(x, y) = (0.5 * (ScatteredEast(x, y) + ScatteredNorth(x, y) + ScatteredWest(x, y) + ScatteredSouth(x, y)))
            Next

        Next
        TT += 1
        Dim img As New ImageBrush
        img.ImageSource = CreateBitmap(CurrentPressure, Dimensions, Dimensions)
        cnvTLM.Background = img

        ' Forcing the CommandManager to raise the RequerySuggested event
        CommandManager.InvalidateRequerySuggested()
    End Sub

    Private Sub btnStart_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles btnStart.Click
        If SimulationTimer.IsEnabled Then
            SimulationTimer.Stop()
        Else
            SimulationTimer.Start()
        End If

    End Sub

    Private Sub FillInColorList()

        Dim f As New SmoothColorGenerator
        SmoothColorList = f.ColorList
    End Sub

    Dim SmoothColorList As New List(Of Color)

    Private Function CreateBitmap(ByVal IntegerArray(,) As Double, ByVal Width As Integer, ByVal Height As Integer, Optional ByVal DistinctColorSettings As Boolean = False) As BitmapSource
        Dim buffer As New List(Of Byte)

        Dim ColList As List(Of Color)
        If DistinctColorSettings Then
            ColList = SmoothColorList
        Else
            ColList = SmoothColorList
        End If

        Dim B_MASK As Integer = 255
        Dim G_MASK As Integer = 255 << 8
        Dim R_MASK As Integer = 255 << 16

        For x As Integer = 0 To IntegerArray.GetLength(1) - 1
            For y As Integer = 0 To IntegerArray.GetLength(0) - 1
                Dim k As Integer = 0
                k = (IntegerArray(x, y) / 2 + 125)

                B_MASK = ColList(k).B
                G_MASK = ColList(k).G
                R_MASK = ColList(k).R


                buffer.Add(B_MASK)
                buffer.Add(G_MASK)
                buffer.Add(R_MASK)
                buffer.Add(255)

            Next
        Next

        Dim dpiX As Double = 96D
        Dim dpiY As Double = 96D
        Dim pixelFormat = PixelFormats.Pbgra32
        Dim bytesPerPixel = Math.Truncate(((pixelFormat.BitsPerPixel + 7) / 8))
        Dim stride = bytesPerPixel * IntegerArray.GetLength(0)

        Return BitmapSource.Create(IntegerArray.GetLength(0) - 1, IntegerArray.GetLength(1) - 1, dpiX, dpiY,
                                         pixelFormat, Nothing, buffer.ToArray, stride) '
    End Function


    Private Function CreateBitmap(ByVal IntegerArray(,) As Integer, ByVal Width As Integer, ByVal Height As Integer, Optional ByVal DistinctColorSettings As Boolean = False) As BitmapSource
        Dim buffer As New List(Of Byte)

        Dim ColList As List(Of Color)
        If DistinctColorSettings Then
            ColList = SmoothColorList
        Else
            ColList = SmoothColorList
        End If

        For i As Integer = 0 To Width - 1
            For j As Integer = 0 To Height - 1
                Dim k As Integer = IntegerArray(i, j)

                buffer.Add(ColList(k).R)
                buffer.Add(ColList(k).G)
                buffer.Add(ColList(k).B)
                buffer.Add(255)

            Next
        Next

        Dim dpiX As Double = 96D
        Dim dpiY As Double = 96D
        Dim pixelFormat = PixelFormats.Pbgra32
        Dim bytesPerPixel = Math.Truncate(((pixelFormat.BitsPerPixel + 7) / 8))
        Dim stride = bytesPerPixel * Width

        Return BitmapSource.Create(Width, Height, dpiX, dpiY,
                                         pixelFormat, Nothing, buffer.ToArray, stride) '
    End Function



End Class

#Region "GenerateColorListClasses"
 

Public Class SmoothColorGenerator

    Sub New()

        GradientStop.Add(Brushes.Red)
        GradientStop.Add(Brushes.White)
        GradientStop.Add(Brushes.Blue)

        For i As Integer = 0 To GradientStop.Count - 2
            GetGradients(GradientStop(i).Color, GradientStop(i + 1).Color, 125)
        Next

    End Sub

    Private pGradientStop As New List(Of SolidColorBrush)
    Public Property GradientStop() As List(Of SolidColorBrush)
        Get
            Return pGradientStop
        End Get
        Set(ByVal value As List(Of SolidColorBrush))
            pGradientStop = value
        End Set
    End Property

    Private pColorlist As New List(Of Color)
    Public Property ColorList() As List(Of Color)
        Get
            Return pColorlist
        End Get
        Set(ByVal value As List(Of Color))
            pColorlist = value
        End Set
    End Property

    Public Sub GetGradients(ByVal starts As Color, ByVal ends As Color, ByVal steps As Integer)
        Dim stepA As Integer = Math.Truncate((CInt(ends.A) - CInt(starts.A)) / (CInt(steps) - 1))
        Dim stepR As Integer = Math.Truncate((CInt(ends.R) - CInt(starts.R)) / (CInt(steps) - 1))
        Dim stepG As Integer = Math.Truncate((CInt(ends.G) - CInt(starts.G)) / (CInt(steps) - 1))
        Dim stepB As Integer = Math.Truncate((CInt(ends.B) - CInt(starts.B)) / (CInt(steps) - 1))

        For i As Integer = 0 To steps - 1

            ColorList.Add(Color.FromArgb(CInt(starts.A) + CInt(stepA) * CInt(i),
                            CInt(starts.R) + CInt(stepR) * CInt(i),
                            CInt(starts.G) + CInt(stepG) * CInt(i),
                            CInt(starts.B) + CInt(stepB) * CInt(i)))
        Next

    End Sub
End Class


#End Region

解决方案

Ok. I found out what was wrong, its the sequence of events.

First calculate all scatter, for all points, then propagate the sound pressure. Or in code:

Private Sub SimulationTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
    ' Updating the Label which displays the current second
    For x As Integer = 1 To Dimensions - 2
        For y As Integer = 1 To Dimensions - 2
            If x = CInt(Dimensions / 2) And y = CInt(Dimensions / 2) Then
                IncommingEast(x, y) = 30 * Math.Sin(2 * Math.PI * TT / 10) + IncommingEast(x, y)
                IncommingWest(x, y) = 30 * Math.Sin(2 * Math.PI * TT / 10) + IncommingWest(x, y)
                IncommingSouth(x, y) = 30 * Math.Sin(2 * Math.PI * TT / 10) + IncommingSouth(x, y)
                InncommingNorth(x, y) = 30 * Math.Sin(2 * Math.PI * TT / 10) + InncommingNorth(x, y)
            End If

            ScatteredNorth(x, y) = 0.5 * (+IncommingEast(x, y) - InncommingNorth(x, y) + IncommingWest(x, y) + IncommingSouth(x, y))
            ScatteredEast(x, y) = 0.5 * (-IncommingEast(x, y) + InncommingNorth(x, y) + IncommingWest(x, y) + IncommingSouth(x, y))
            ScatteredWest(x, y) = 0.5 * (+IncommingEast(x, y) + InncommingNorth(x, y) - IncommingWest(x, y) + IncommingSouth(x, y))
            ScatteredSouth(x, y) = 0.5 * (+IncommingEast(x, y) + InncommingNorth(x, y) + IncommingWest(x, y) - IncommingSouth(x, y))

        Next
    Next

    For x As Integer = 1 To Dimensions - 2
        For y As Integer = 1 To Dimensions - 2

            IncommingEast(x, y) = ScatteredWest(x + 1, y)
            InncommingNorth(x, y) = ScatteredSouth(x, y + 1)
            IncommingWest(x, y) = ScatteredEast(x - 1, y)
            IncommingSouth(x, y) = ScatteredNorth(x, y - 1)

            CurrentPressure(x, y) = (0.5 * (ScatteredEast(x, y) + ScatteredNorth(x, y) + ScatteredWest(x, y) + ScatteredSouth(x, y)))
        Next

    Next

    TT += 1
    Dim img As New ImageBrush
    img.ImageSource = CreateBitmap(CurrentPressure, Dimensions, Dimensions)
    cnvTLM.Background = img

    ' Forcing the CommandManager to raise the RequerySuggested event
    CommandManager.InvalidateRequerySuggested()
End Sub


这篇关于关于传输线矩阵算法的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆