please use MATlab and answer in 15 minutes
Code:
clc
clear
%Straight line, Y = MX + C
X = linspace(0, 10, 4);
Y1 = [60 350 700 900];
P1 = polyfit(X, Y1, 1);
YP1 = polyval(P1, X);
M1 = P1(1)
C1 = P1(2)
plot(X, Y1, 'ro', X, YP1, 'b-');
Y2 = [2180 2160 2110 2000];
P2 = polyfit(X, Y2, 1);
YP2 = polyval(P2, X);
M2 = P2(1)
C2 = P2(2)
hold on
plot(X, Y2, 'ms', X, YP2, 'k-');
legend('data1', 'striaght line 1', 'data2', 'striaght line 2')
figure
XQ = 0:0.01:25;
Ys1 = interp1(X,Y1,XQ,'linear','extrap');
Ys2 = interp1(X,Y2,XQ,'linear','extrap');
plot(XQ, Ys1, XQ, Ys2);
Output:
AT X = 21.83 approx values are same
And Data 2 and the two fitted lines over the range o 3.3 Plot on the same groph Data 3.4 Find the...