필터 지우기
필터 지우기

uniform density, matrix

조회 수: 3 (최근 30일)
PChoppala
PChoppala 2011년 10월 15일
Hi there, I am working on a new project starting last week, and hence I have been asking too many questions. Thanks for all who helped me.
Again, I have 3 simple queries looking for suggestions ASAP.
I am working on particle filter where I need to initialize the velocity, Intensity and position of (say N = 100) particles
Can you suggest me the M-code for
1. Drawing a value for the velocity from the uniform distribution
v ~ U[-vmax, vmax] , where vmax = 1 unit/sec
2. Drawing a value for intensity from the uniform distribution
I ~ U[Imin, Imax] , where Imin = 10, Imax = 30
3. I have a matrix(or a frame(image) in my case) called 'z', say its a 3x3 frame.
x = [1.2, 0.45, 0.2, 0.25, 20]';
n=3;
m=3;
blur = 0.7;
a = 3.*randn(n,m);
for i=1:n
for j=1:m
if i-x(1) < 3 && j-x(3) <3
h(i,j) = x(5)/(2 * pi * (blur^2)) * exp(-((i-x(1))^2 + (j-x(3))^2)/ (2* (blur^2)))
else
h(i,j) = 0
end
end
end
z = a + h;
So, 'z' will be a 3x3 frame having certain values for the pixels.
The values in 'x' are [position in x-axis, velocity in x-axis, position in y-axis, velocity in y-axis, Intensity].
So the pixels in frame 'z' that fall in the vicinity of the position given my 'x' in x-y direction will have higher values(Intensity than others)
now, what I want is, the position of the particles should be initialized from the distribution q(x,y | z) is a uniform density over those regions in 'z' for which z(i,j) > T
T = threshold = 2
I need to draw values from that distribution.
Okay, I assume I have made myself clear. Can you friends please help!
Many thanks
P

채택된 답변

the cyclist
the cyclist 2011년 10월 15일
Do you have the Statistics Toolbox? You can use the function unifrnd() to do at least some of what you need.
  댓글 수: 1
PChoppala
PChoppala 2011년 10월 15일
So that would solve my 1 & 2 points
1. x1 = unifrnd(-1,1,2,N)
2. x2 = unifrnd(10,30,1,N)
Can you help m out with the third?
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by