{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

EGR_102_Lab_05A_Solution - plot(x_plot,y_plot title'Linear...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab 05A Homework Name: Solution Section # Spring 2012 The script was saved as tensile_strength.m % Script 'tensile_strength.m' % Name, Section # % This script calculates the least-squares linear fit of a set of tensile % strength and time data supplied. It also plots the linear fit over a % 3-hour heating period. % Step 1 x = 10:20:110 % min y = [15.8 48.4 81.2 147.5 186.8 204] % MPa % Step 2 x_summed = sum(x); y_summed = sum(y); xsq_summed = sum(x.^2); xy_summed = sum(x.*y); % Step 3 n = length(x); a1 = (n*xy_summed - x_summed*y_summed)/(n*xsq_summed - x_summed^2) % Step 4 x_ave = mean(x); y_ave = mean(y); a0 = y_ave - a1*x_ave % Step 5 x_plot = 0:30:180; y_plot = a1*x_plot + a0; plot(x_plot,y_plot)
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: plot(x_plot,y_plot) title( 'Linear Fit Line of Heat Treated Metal Composite' ) xlabel( 'Time heat treated (min)' ) ylabel( 'Tensile strength (MPa)' ) grid on % Extra hold on plot(x,y, 'rs' ) % adding the original data points to the plot hold off Command Window Output >> run tensile_strength x = 10 30 50 70 90 110 y = 15.8 48.4 81.2 147.5 186.8 204 a1 = 2.0321 a0 = -7.9786 According to the linear fit line, the tensile strength after 180 minutes should be approximately 358 MPa 20 40 60 80 100 120 140 160 180-50 50 100 150 200 250 300 350 400 Linear Fit Line of Heat Treated Metal Composite Time heat treated (min) Tensile strength (MPa)...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern