Polynomial of Random Variables

Does MATLAB has a special type of commends to create polynomial of random variables?
I mean that I want to create polynomials of variable like , and from
Furthermore, I want to plot pdf, or calculate mean of those kind of functions.
For example, I tried using command "makedist" to create "pd1" which represents .
pd1=makedist('Normal')
Then, I can plot its pdf or calculate mean like following.
x=[-2:0.1:2]
y=pdf(pd1,x)
plot(x,y)
m=mean(pd1)
After that, I wanted to create variable "pd2" that correspond to for such that I can repeat previous trials ,such as plotting pdf or calculating mean, variance like following.
x=[-2:0.1:2]
y=pdf(pd2,x)
plot(x,y)
m=mean(pd2)
Does anyone know how to create "pd2" that I mentioned by using given "pd1"? I tried commends like following but it failed.
pd2=pd1.^2+2
In general, does anyone know how to create polynomial of given random variable?
Any help or advise would be thankful.

2 Comments

In expressions like Z^4 + Z + 2 are the Zi same for each term or independent samples?
Same for each term.

Sign in to comment.

 Accepted Answer

Then
b=[1 0 0 1 2]; % coefficients 4th order poly
P=polyval(b,normrnd(mu,s,m,n)); % generate mxn rand poly(Z(mu,s))
Subsequent distribution will, of course, not be normal; just how far will deviate will depend on magnitude of coeffiecients and the specific polynomial chosen...even power term(s) will increase height but not introduce skewness; odd term(s) will introduce skewness.
You'll then have to use fitdist to create empirical distributions from the resulting estimated empirical distributions.

3 Comments

Thanks for your answer. I've never thought about this good approach.
I have an additional question. When using fitdist commend, I have to designate type of empirical distribution. Is there any other way that does not need to designate type? What I want is creating distribution of general polynomial of normal random variables.
Well, there is no specific distribution that an arbitrary polynomial will generate -- you'll have to either make do with an approximation of one of the simpler parametric models--the chosen polynomial may not generate sufficient nonnormality but what you can still "get by" by fitting a normal with estimated mean, variance. If not, fitdist supports either the Pearson or Johnson flexible distributions that can model a wide range of distributions or there are some 30 others you can select from and see how reasonable the resulting fit is.
Or, you can go to a non-parametric representation of if all else fails, revert to empirical representation.
We have no idea what the end use or intent is so can't even guess as to what might be the best thing to try to do.
Thank you again for your comment.
I tried kernel distribution and it gave nice plotting graph, which is almost close to the answer what I want.

Sign in to comment.

More Answers (0)

Products

Asked:

on 28 Jul 2019

Commented:

on 29 Jul 2019

Community Treasure Hunt

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

Start Hunting!