I already posted a similar question on this link, but it didn't work out maybe because I haven't expressed myself clearly enough or I haven't been able to understand the answer. However, this question is more precise since I have realized my project using R (R Studio). Unfortunately, I have recognized that R Studio calculates my Poisson-Matrix as slow as Excel, which is why I am forced to do my project using Matlab.

R code:

```
a <- Table$ValueA
b <- Table1$ValueB
lapply(a,function(a) {lapply(b,function(b) {outer(dpois(0:20,a), dpois(0:20,b))})})
```

Excel calculation:

```
= POISSON(x;a;FALSE) * POISSON(x;b;FALSE)
```

, where **a** and **yes** they are variables to which all pairs of input values are assigned, one after another. **X** It is a variable that goes from 0 to 20.

Then, for each input-value pair register (**a, b**) (located in two columns) I want to create a Matrix that is based on previous Poisson calculations, with X from 0 to 20.

Then p. The first result in the matrix, in cell (1,1) is based on the following calculation:

```
= POISSON(0;a;FALSE) * POISSON(0;b;FALSE)
```

The following graphic shows the matrix in Excel:

Finally, I want to summarize three parts of that matrix and present these three values next to the two columns (which contain the input values **a** and **yes**) for each input value register:

1) Sum of: The **diagonal** from the upper left corner to the lower right corner

2) Sum of: The el **upper rest** of the matrix

3) Sum of: The **lower rest** of the matrix

It would be great if there was someone to help, since I really hope to increase performance with Matlab!

THANKS!