Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

An acceleration of a heavily loaded vehicle is given by the generalised equation

ID: 3198231 • Letter: A

Question

An acceleration of a heavily loaded vehicle is given by the generalised equation (the independent variable m) F[mjorder a - yorder +Imorder A. Write a function that performs linear regression by linearising the saturation-growth rate (SGR) model function [F, V, a0, a1, r2] LinRegrSGR(x, y, order) B. Use the function written in part A to estimate F and V using the data below, for a second-order equation (order-2). Then plot the raw data as red squares and print the values of F, V, ao, a1 and r values 1.3 0.07 1.8 0.13 4.5 0.275 9 0.36 0.22 0.335 0.35 C. Plot the fitted curve from m -1 to 10 with a spacing of 0.1 with a blue dashed line. Place the legend in the north-west location

Explanation / Answer

%Function
function [F,V, a0,a1,r2]=LinRegrSGR(x,y,order)
%we linearize the data
y=1./y;
x=1./(x.^order);
y=y';
x=x';
%Linaer regression
X = [ones(length(x),1) x];
a = Xy;

a0=a(1);
a1=a(2);

F=1/a0;
V=(a1*F)^(1/order);
%We calcular R2, using the estimated y's
yCalc1=X*a;

r2 = 1 - sum((y - yCalc1).^2)/sum((y - mean(y)).^2);


end

%Script
%b)
x=[1.3 1.8 3 4.5 6 8 9 ];
y=[0.07 0.13 0.22 0.275 0.335 0.35 0.36];
order=2;
[F,V, a0,a1,r2]=LinRegrSGR(x,y,order);

plot(x,y,'sr')
disp('The valueas are')
fprintf('F=%f V==%f a0=%f a1=%f r2=%f',F,V,a0,a1,r2)

%c)
%We get the function
a=@(m)((F.*(m.^order))./(V.^order+m.^order));
xx=1:0.1:10;
yy=a(xx);

plot(x,y,'sr',xx,yy,'--b')
xlabel('m')
ylabel('a')
title('Acceleration of a heavily loaded vehicle')
legend({'Raw Data','Fitted function'},'Location','northwest');

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote