Hello, I want to average each column in 'B' and arrange the averages in an array so that each row of the new array will display the set of averages relating to the final stock price B(n+1,i).
Thats where I am having difficulty.Thank you for your efforts
n=4i=1:16B = Columns 1 through 11 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 100.0000 90.0000 90.0000 90.0000 90.0000 110.0000 90.0000 90.0000 90.0000 110.0000 110.0000 110.0000 81.0000 81.0000 81.0000 99.0000 99.0000 81.0000 99.0000 99.0000 99.0000 99.0000 121.0000 72.9000 72.9000 89.1000 89.1000 89.1000 89.1000 89.1000 108.9000 89.1000 108.9000 108.9000 65.6100 80.1900 80.1900 80.1900 80.1900 98.0100 98.0100 98.0100 98.0100 98.0100 98.0100 Columns 12 through 16 100.0000 100.0000 100.0000 100.0000 100.000 110.0000 110.0000 110.0000 110.0000 110.000 121.0000 121.0000 121.0000 121.0000 121.000 108.9000 133.1000 133.1000 108.9000 133.100 119.7900 119.7900 119.7900 119.7900 146.410
Each column in B is a price trajectory of an asset, the asset moves up or down at each row, but some paths end up at the same point after n+1 time steps.
so I have multiple price paths ending at the same point.
I want to average the paths and group them together such that I will have a set of averages relating to one final stock price.
for example my new array A will look like
so A will look something like this
A=
81.9020 0 0 0 0 0 84.8100 88.0500 91.6500 95.6500 0 0 91.6200 95.2200 99.1820 99.2200 103.1800 107.5800 103.5300 107.5300 111.9300 116.7700 0 0 122.1000 0 0 0 0 0
….. so each row of A displays the set of averages for each price path ending at the same point. row 1 of A has the averages for final stock price 65.61 row 2 of A has the averages for final stock price 80.19 for 2 of A has the averages for final stock price 98.01
Best Answer