How to do normalize distribution technique on a simple matrix?

2 次查看(过去 30 天)
This is just a practice about normal distribution in MATLAB and not a real project.
I created a simple matrix and want to test normal distribution on it, it's
x=[1 2 3 4 5 6 7 8 9 10 11 12 13 16 18 20 800 801 802 803 810 850]';
After that I used 'distributionFitter' Toolbox in MATLAB and plot it and as you can see it has not a normal distribution:
nd.png
I was reading MATLAB help and found these codes:
pd = fitdist(x,'Normal');
%I change this code to have a same x_values vs x
x_values = linspace(min(x), max(x), size(x,1));
y = pdf(pd,x_values);
It works but I'm so confused about which variable is my final data? I mean I'm looking for a data who has been normal distribution?
If my codes are wrong how can I convert x to a matrix with normal distribution?

采纳的回答

Image Analyst
Image Analyst 2019-12-2
Try this:
pd = fitdist(x, 'Normal')
% Get 1000 random numbers from this distribution:
r = pd.sigma * randn(1000) + pd.mu;
% View the histogram so we'll see that it has a normal shape.
histogram(r)
grid on;
  2 个评论
motevalizadeh
motevalizadeh 2019-12-2
sorry if my question is simple or..., you mean r is my new data with normal distribution?
Image Analyst
Image Analyst 2019-12-2
Yes. Isnt' that what you wanted? To generate some new values as if they were taken from the same process that generated your training data? The new random values, r, will be normally distributed as you can see from the histogram.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by