Problem with Random data delay - Signal Processing,
이전 댓글 표시
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
Jan
2011년 9월 14일
@Susan: You've posted two functions. Which one causes the problems? I'd expect that the "test" function calls the "nonhomogeneousPossion" function, but it doesn't. It calls "Trial11" instead, but you did not post the corresponding code...
A usual cause for getting the same reply for random data is a seeding of the random number generator.
Susan
2011년 9월 14일
Jan
2011년 9월 14일
If I run your code (after some modification to get it compatible to 2009a), I get different values in each run. So waht is the exact problem?
Susan
2011년 9월 14일
Jan
2011년 9월 14일
Sorry, then I did and do not understand the question. Is your question like this: "How to insert some zeros at the beginning of a 1D signal"? Then posting the complicated code would have been too confusing.
Susan
2011년 9월 14일
Susan
2011년 9월 14일
답변 (1개)
Daniel Shub
2011년 9월 14일
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
Susan
2011년 9월 14일
Daniel Shub
2011년 9월 14일
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
2011년 9월 14일
카테고리
도움말 센터 및 File Exchange에서 Subspace Methods에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!