Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 %The same data is used for the activity. These are provided for you. 2 X = [-2 -1 1 2].' 3 Y = [3

image text in transcribed

1 %The same data is used for the activity. These are provided for you. 2 X = [-2 -1 1 2].' 3 Y = [3 1 0 1].' 4. 5 %Use the length() command to determine the size of the column vector x. Store this value in m. 6 7 %Set up the appropriate matrix A to find the best-fit parabola of the form y=C+Dx+Ex^2. The 8 %first column of A will contain all l's, using the ones() command. The second column of A 9 %contains x values that are stored in X. The third column of A contains the squared x values 10 %that are stored in X. Elementwise multiplication of x by itself, using .* operator, will 11 %produce the desired values for the third column. 12 13 %Calculate the matrix products. These are provided for you. 14 A_transposeA = A.' 15 A_transposeY A = A. Y 16 17 %Use the backslash operation to solve the overdetermined system. Store this in Soln2. 18 19 %Define the x values to use for plotting the best-fit parabola. This creates a vector x. 20 %This is provided for you. 21 X=-4: 0.1 : 4 22 %Define the best-fit parabola, storing it in yquadratic. Elementwise multiplication of the 23 %x values times themselves to square them is achieved by using .* operator (because x is a vector). 24 25 %The following sequence of commands plots the data and the best-fit parabola. The command is 26 %provided for you. 27 plot(x, yquadratic, X, Y, 'k*');grid;shg 1 %The same data is used for the activity. These are provided for you. 2 X = [-2 -1 1 2].' 3 Y = [3 1 0 1].' 4. 5 %Use the length() command to determine the size of the column vector x. Store this value in m. 6 7 %Set up the appropriate matrix A to find the best-fit parabola of the form y=C+Dx+Ex^2. The 8 %first column of A will contain all l's, using the ones() command. The second column of A 9 %contains x values that are stored in X. The third column of A contains the squared x values 10 %that are stored in X. Elementwise multiplication of x by itself, using .* operator, will 11 %produce the desired values for the third column. 12 13 %Calculate the matrix products. These are provided for you. 14 A_transposeA = A.' 15 A_transposeY A = A. Y 16 17 %Use the backslash operation to solve the overdetermined system. Store this in Soln2. 18 19 %Define the x values to use for plotting the best-fit parabola. This creates a vector x. 20 %This is provided for you. 21 X=-4: 0.1 : 4 22 %Define the best-fit parabola, storing it in yquadratic. Elementwise multiplication of the 23 %x values times themselves to square them is achieved by using .* operator (because x is a vector). 24 25 %The following sequence of commands plots the data and the best-fit parabola. The command is 26 %provided for you. 27 plot(x, yquadratic, X, Y, 'k*');grid;shg

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago