Estimate pdf of image of a uniform distribution keeping the same number of points
2 views (last 30 days)
Show older comments
I have a initial vector
, which is transformed in another vector w with the same length via a transformation which I would like to estimate the probability density function of. Moreover, i can assume that
and
. I would also like the estimated pdf to have the same length N as v and w. I found that a good way to do this might be using the function ksdensity (correct me if I am mistaken), but I do not know how to specify that my vector w comes initially from a uniform distribution and to specify that I want the pdf to be estimated in the points
, so that it will be a vector of length N.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1819824/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1819829/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1819834/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1819839/image.png)
7 Comments
Answers (2)
Torsten
on 8 Dec 2024
Moved: Image Analyst
on 8 Dec 2024
I'd first try what you get as the usual empirical probability density using something like
v = linspace(0,1,1000);
w = v.^2;
histogram(w,'Normalization','pdf')
0 Comments
Jeff Miller
on 8 Dec 2024
A histogram seems quite useful but doesn't easily give the N pdf values that the OP wants.
If the transformation is monotonic, then you already have the cdf:
v = linspace(0,1,1000);
w = sqrt(v);
plot(w,v) % cdf of w
Knowing the length of each little w(k) to w(k+1) interval, it seems like you can work out the pdf in that interval (e.g., assuming it is flat) with something like this. That gives you one less than the number of pdfs you want, so you probably need to make an assumption about what is going on at one end or the other.
histogram(w,'Normalization','pdf')
cdfjumps = w(2:end) - w(1:(end-1));
mids = (w(2:end) + w(1:(end-1))) / 2;
pdfs = 0.001 ./ cdfjumps;
hold on
plot(mids,pdfs)
12 Comments
Jeff Miller
on 11 Dec 2024
If you want to know the final distribution after advection, why not just construct the histogram of the particle positions after advection, as @Image Analyst suggested 9 Dec at 13:08 (I too think he meant positions instead of sizes)? As long as the starting positions are always the same (i.e., uniform), I don't see why you need to adjust the average post-advection positions for their initial distribution.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!