Problem with Random data delay - Signal Processing,

1 view (last 30 days)
Dear all,
I need to generate random data using non-homogeneous Poisson and put it in the X-axis and generate another data using non-homogeneous Poisson but delay it with some time then calculate the delay time.. I understand the steps of doing this,, I generated different data but using Gaussian and I used cross correlation for estimating the time delay..and for delaying one of the signals I used zero-padding.. I know how the whole process should be and I understand from generating couple of files and asking questions here. But my problem now, from the code I've done so far for the non-homogeneous Poisson, I am not sure how to find the X and Y entries for the signal created because If I find the X and Y.. I can shift the other signal by zero-padding then use Cross correlation to find an estimate delay.. I don't know if the code I've done so far is wrong or something is missing!! Just to clarify the random data generated using non-homogeneous should be on the X-axis (Red data) and the estimated function for the data is kernel..I don't know if i generated the non-homogeneous Poisson correct because every time I run the data are in the same place and It should be random data(changing everytime I run)?!!
http://www.stat.sdu.dk/matstat/yuri-st505/w5slides1.pdf [The non-homogeneous algorithm in the last page ].
function test
lambdaMax=45;
T=50;
x=-2*pi:1/5:2*pi;
lambda =@(x)( sin(x)*(20+30));
S = Trial11(lambdaMax,lambda,T)
hold on
line(repmat(S,2,1),repmat([0;1*0.006],1,length(S)),'color','r' )
[xi,f]=ksdensity(S);
plot(f,xi,'color','blue');
end
function S = trial11(lambdaMax,lambda,T)
t = 0;
I = 0;
S = [];
u = rand;
t = t - log(u)/lambdaMax;
while t <= T
u=rand;
if (u < lambda(t)/lambdaMax)
I = I+1;
S(I) = t;
end
u = rand;
t = t - log(u)/lambdaMax;
end
Any help and explanation will be highly appreciated ! Thanks all for your time, Susan
  7 Comments
Susan
Susan on 14 Sep 2011
Yeah but I know how to do the zero-padding if I have X and Y.. but how can it be done if my random data generated is in S (no X and Y)

Sign in to comment.

Answers (1)

Daniel Shub
Daniel Shub on 14 Sep 2011
Typically a Poisson process (homogenous or non-homogenous) produces a set of times at which event occurs. This is very different from a Gaussian process which produces a value at all times. With the Gaussian process you have "x" and "y" data, but with a Poisson process you only have "t" ((which you are calling S). You can create x and y from t. The easiest way would be to:
sr = 44.1e3; % A reasonable sample rate for audio applications
z = round(S*sr)+1; % Need to transform S from seconds to indices
x = 0:1/sr:T;
y = zeros(size(x));
y(z) = 1;
  3 Comments
Daniel Shub
Daniel Shub on 14 Sep 2011
The last line sets the values of y to be equal to 1 at the times at which the Poisson process indicated that events occurred. To best match your code you could use 0.006 instead of 1. I think ksdensity only works for things that are normal (or close to normal) so I would not use it here (but then again I have no idea what you are trying to do). To plot the results, you could use:
stem(x, y)
Susan
Susan on 14 Sep 2011
I am trying to generate non-homogeneous data and plot it in the X-axis basically to show the time the data arrived then estimate a function for the arrived data and in my case i used Ksdensity(don't know if there are anyother ones) onces its estimated i will be able to generate another data but delayed with sometime and estimate the function for that one too !

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!