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

Need Matlab Code: Q1) Given the following data: x10 5 10 15 20 25 30] y10 358.27

ID: 2291852 • Letter: N

Question

Need Matlab Code:

Q1) Given the following data: x10 5 10 15 20 25 30] y10 358.27 684.56 827.73 843.51 786.98 696.01] zI0 71.653 68.456 55.182 42.176 31.479 23.2] (i)Use regression analysis to fit a parabola to y as a function of x and plot the parabola (line only) and the data (symbols only) (DO NOT USE polyfit.) (i) Use regression analysis to fit a 4h-order polynomial to z as a function of x and plot the results.(DO NOT USE polyfit.) (i) Calculate the correlation coefficients of the analyses in (i) and (ii) iv) Integrate the polynomial functions of (i) and(ii) analytically (v Substitute x-30 into each of the integrated functions in (iv). What is the ratio of the results?

Explanation / Answer

MATLAB CODE :

x = linspace(0,30,7)';
y = [0 358.27 684.56 827.73 843.51 786.98 696.01]';
z = [0 71.653 68.456 55.182 42.176 31.749 23.2]';

% 1st order interpolation.
f_y1 = fit(x,y,'poly1');
y1 = polyval([f_y1.p1 f_y1.p2], 4); % required value
f_z1 = fit(x,z,'poly1');
z1 = polyval([f_z1.p1 f_z1.p2], 4); % required value

% 2nd order interpolation.
f_y2 = fit(x,y,'poly2');
y2 = polyval([f_y2.p1 f_y2.p2 f_y2.p3], 4); % required value
f_z2 = fit(x,z,'poly2');
z2 = polyval([f_z2.p1 f_z2.p2 f_z2.p3], 4); % required value

% 3rd order interpolation.
f_y3 = fit(x,y,'poly3');
y3 = polyval([f_y3.p1 f_y3.p2 f_y3.p3 f_y3.p4], 4); % required value
f_z3 = fit(x,z,'poly3');
z3 = polyval([f_z3.p1 f_z3.p2 f_z3.p3 f_z3.p4], 4); % required value

% plots
figure();
subplot(1,2,1);
plot(f_y1, x, y, 'go-'); hold on;
plot(f_y2, x, y, 'ro-'); hold on;
plot(f_y3, x, y, 'bo-'); hold off;
legend('1st order', '2nd order', '3rd order'); title('y data');

subplot(1,2,2);
plot(f_z1, x, z, 'go-'); hold on;
plot(f_z2, x, z, 'ro-'); hold on;
plot(f_z3, x, z, 'bo-'); hold off;
legend('1st order', '2nd order', '3rd order'); title('z data');

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