uniform density, matrix
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!