Adding a Vector at Certain Points of a Sequence
I am trying to simulate an expirnment, where a signal (gaussian peak) is added to itself in accordance to a random binary sequence. I have already generated the binary sequence, but need assistance with the addtion of the signal to itself.
Binary sequence is 0 or 1 at a 50% probablity.
The gaussian peak is generate by normpdf with a total x value of 1000.
When the binary sequence is at 1, I would like for the gaussian peak to be added to the original and when the binary sequence is at 0 nothing happens. This means that the sequence's start point would be offset by the location of the 1. So, if the 1 is the at location 100 of the sequence, the gaussian peak would have to start 100 points ahead of the orginal.
The signals need to be added to eachother sequentially. This means the third 1 value must be added to a signal that already has the first two 1 values summed into it.