Square approximation with a second degree polynomial, function determine.

Good morning, please explain how to do this in matlab? Thank you in advance for your help.
For the data in the table:
make the mean-square approximation using a second degree polynomial.
Determine the parameters of the function , which in the sense of least squares approximates these data.
Which of these approximating functions would you choose and why?

 Accepted Answer

Simply, you need to use Curve Fitting app for this purpose. Define your Xi and f(Xi) vectors in MATLAB workspace. Then open Curve Fitting app to use the variables that you define. Then, select Custom Equation option for fitting a curve and enter the equation of yours into there. You should get a perfect curve with specified parameters. I did on my side. I don't paste the answer because I want you to do and learn.
The reason for selection and exponential function is the dataset exhibits a normal distribution behavior.

6 Comments

Thank you for the advice. I am a beginner in matlab. Unfortunately, this task is beyond my abilities. I would ask for a detailed answer if possible.
Ok, defining variables is pretty easy in MATLAB:
x=1:0.25:2.5;
y=[0.16 0.99 3.095 4.485 3.075 1.01 0.145];
After this, in the Apps tab of MATLAB, open Curve Fitting app. It should look something like this:
So, the defined variables will be selected in X data and Y data tabs respectively. After that, select Custom Equation option at the tab where it is selected Polynomial in this figure. After that, enter your exponential equation and you will obtain the parameter of the equation.
What form of matlab notation should the function be ?
You can define it either symbolically or numerically. I would use symbolic approach:
syms f(x)
%%insert a0 a1 and a2 values before defining the function
f(x)=exp(-(a0+a1*x+a2*x^2));
Since you found the values of constants, you should insert them to the function:
can you also explain me how to insert this values? Sorry for my questions but I'm really just learning to use matlab.
I am a frontend specialist. But unfortunately in postgraduate studies I got a task that I have to do in matlab. And matlab is new to me. The most important thing for me is to complete this quest, so thank you for your help.

Sign in to comment.

More Answers (0)

Categories

Products

Community Treasure Hunt

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

Start Hunting!