The following data points are given:
x
5
6
10
15
20
40
70
100
y
83
92
100
97
91
75
61
53
a) Plot the data points as ‘s’ squares.
b) Determine the constants A and B by curve fitting. Output Aand B
to the command window.
c) In the same figure as the data points, plot the fitted curveas a continuous
curve in 3 ≤ x ≤ 120.
Submit: 1) Script, 2) Numerical values of A and B in commandwindow,
and 3) Figure.
Solution
`Hey,
Note: Brother in case of any queries, just comment inbox I would be very happy to assist all your queries
clear all
clc
x=[5,6,10,15,20,40,70,100];
y=[83,92,100,97,91,75,61,53];
disp(‘Values of A and B are’);
C=polyfit(x,y,1)
yy=polyval(C,x);
plot(x,yy,x,y,’s’);
Kindly
OR
OR