Question

We would like to fit data to the equation y -a, that is, a horizontal line. (a) For the equation above, define a function ф(a
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hello,
       Please find the answer attached below. If the answer has helped you please give a thumbs up rating. Thank you and have a nice day!

For part (c), the data given is a 2d data, for which the variable 'a' will be a vector of 2 values, representing the slope and the y-intercept of the best fit line. The value of a is found using Matlab:

**************** Code ***********

y = [-0.886 -2.573 -0.455 -1.901 -0.224 -0.109 -0.794 -2.681 0.638 -0.288]';                    % y data
x1 = [-4.524 -10.880 -8.532 -14.339 -12.998 -15.231 -19.297 -26.111 -21.014 -25.630]';          % x data
n = ones(size(x1));
x = [n x1];                                                                                     % formatting x data
a = x\y     

*************** End of Code ***********

Output:

a =

   -0.9278
   -0.0000

However, here the second value is zero, which means a = -0.9278

******************************************************

PS: Please do not forget the thumbs up!!

Add a comment
Know the answer?
Add Answer to:
We would like to fit data to the equation y -a, that is, a horizontal line....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT