How to get simulated values for a polynomial given the coefficients.

Hi,
I need to simulation 1000 values out of a polynomial which I have the coefficients and errors. What is the best way to do that in Matlab. Is there a function already?
Thanks a lot.

2 Comments

Are you trying to generate a random sample set of polynomial coefficients given some type of error distribution of the coefficients? Or what?
Thanks. I have the coeeficients of polynomial: a0 + a1*x + a2*x^2 + a3*x^3. I need to simulate 1000 polynomial values

Sign in to comment.

 Accepted Answer

I have no idea what you want to do.
If you want to evaluate your polynomial (represented by the coefficient vector) at a particular value of the variable, use the polyval (link) function.

4 Comments

Thanks! How to use the error term, since my coefficients are from regression of many scattered data.
My pleasure.
The errors are most likely modeled as being normally distributed, so the randn or normrnd functions could work. however, that is not the best way to calculate prediction confidence limits.
Rather than generating a number of simulations, if your polynomial fits created confidence intervals on the predictions, such as those created by the polyconf (link) function, use that instead. (If you do not have the Statistics and Machine Learning toolbox, the File Exchange contribution polypredci (link) does the same.)
Let me read....Thank you so much!

Sign in to comment.

More Answers (0)

Products

Tags

Asked:

JFz
on 2 Jan 2018

Commented:

on 2 Jan 2018

Community Treasure Hunt

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

Start Hunting!