Question: Using c++ write a code for the following problem. Please show your output screen (Curve Fitting) In an engineering problem, we know that there is
(Curve Fitting) In an engineering problem, we know that there is the following quadratic relationship between X and Y Although we know the structure of the relationship, we do not know the parameters a, b and c. To find these parameters, we do 11 measurements and for different values of X, record the value of Y. The following is the result of the 11 measurements we have made (there is a little noise, so the measurement is not 100% accurate) 5 43-2 0 23 4 5 .96. 3.1 1.35 0.6 0.8 2.1 4.17.5 11.5 16.9 measured We want to find the best possible values of a, b, c using the measurement above. The best values will result in the least error sum For example: Lets assume a 1, b =-1 and c 0.5. Then based on the formula if we put X = 3, then Y will be Y 1"(3)^2 + (-1)*3 + 0.5 = 6.5 As you see for a 1, b =-1 and c 0.5, the formula for X = 3 gives Y = 6.5 whereas our measurements has recorded 7.5. So we have abs(75-65) 1 unit of error. We will have more or less error with other measurements as well The best values of a, b, and c are the ones that result in the least sum of errors Your task: 1) Write a program that uses the vector class to define two vectors X and Y. Initialize the vectors with the measurement result (Row 1 is X and Row 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
