# Matrix operations and initial conditions

Hello everybody, I have a problem and I will be very grateful if somebody can help me...

I'm using VISSIM to implement on a DSP a recursive algorithm for estimation (matricial operations principally) . My problem is that I need to set up initial conditions to start the algorithm and then use the last results for the next estimation but I don't know how to do it with VISSIM (the algorithm wil be implemented on a DSP by Texas Instruments, F2808). I was thinking in using the block merge, but I don't figure out which signal can I use for the boolean condition. This signal has to set up the initial conditions every time the algorithm starts. Any idea???

Thanks a lot for the help

Best regards, Danilo

### Could you attach the new

Could you attach the new diagram please, because I can't figure out where to put the delay 1/z. Thanks a lot

### Thanks for the help

Thanks for the help

### The problem was that you had

The problem was that you had no delay inducing block between your calculation of Xk and Xk-1. I have added a 1/Z in the attached and now there is no complaint. Diagram is attached below (you must be signed in to see it and download it).

### Hi Danilo, Normally if you

Hi Danilo, Normally if you are using recursion you will want to use the clocked delay (1/Z) block. It takes a matrix input and accepts a matrix as initial condition. You can use bracket notation for direct initialization (i.e. [1 2;3 4]) or use a variable that is defined as a matrix. No need for merge though if you did use a merge, use the built-in variable \$firstPass as the selector.

### \$firstPass

Hello, thanks for the answer. I'm quite new in VISSIM so I don't know all possibilities and capabilities. To implement the built-in variable \$firstPass I have to use a expression block or which block. Thanks for the answer.

### Use a variable block. In the

Use a variable block. In the drop down you will find \$firstPass, \$lastPass, \$timeStep etc.

### Algebraic Loop

Thanks a lot, now I got a new problem... When I play the simulation a message indicates that there is an algebraic loop.

But it is on one sum and one multiplication which are part of my algorithm. Do you have any idea how to solve it? Sorry for bothering you

### You can't have a feedback

You can't have a feedback loop unless it is broken by an integrator or unit delay (1/Z). The reason is that you need a fixed place to start calculating on each time step, and a place to hold the result for the next iteration. Read more detail here

### Feedback

Thanks again, I have seen before the document you suggested to me. But It is not really a feedback loop where I get the algebraic loop. It's in a matrix multiplication and in a matrix sum. But I don't get that problem in all the operations done, only in two ones. The other algebraic loop appears when I use the block vector to scalar, because I need to assign each entrance in a vector to individual variables.

### Please attach diagram so we

Please attach diagram so we can make informed comment.