14-440-127 Recitation 11 Problems- Solutions

14-440-127 Recitation 11 Problems- Solutions - 14:440:127-...

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

View Full Document Right Arrow Icon
14:440:127- Introduction to Computers for Engineers Problems for students to attempt in Recitation 11. 1) Given the following points, linearly interpolate to find the values at x=12.4, 13.6, and 14.7 X = 10:15; Y = [21 21.8 25.3 26 27.8 30.3]; X = 10:15; Y = [21 21.8 25.3 26 27.8 30.3]; newy = interp1(X,Y, [12.4 13.6 14.7] ) 2) Given the following points, calculate cubic splines to interpolate between these points, and then graph the originals (as X’s) and the splines on the same graph: X = 10:15; Y = [21 15 25.3 35 27.8 30.3]; X = 10:15; Y = [21 15 25.3 35 27.8 30.3]; newx = 10:0.01:15; %% if the interval is too big, it won't graph as a curve %%% because you'll only have a couple of points for the new y’s, %%% and matlab will connect them with lines %%% when you have lots of points, matlab still connects each set of points with lines %%% but they’re so close together, you can’t tell newy = spline(X,Y,newx); plot(X,Y, 'X' ,newx,newy) 3) Find the equation of the line that best fits the following data points using least squares regression: X = 10:15; Y = [21 21.8 25.3 26 27.8 30.3]; X = 10:15; Y = [21 21.8 25.3 26 27.8 30.3]; coefs = polyfit(X,Y,1); coefs = (round(coefs*100)/100); %%% round to 2 decimal places disp(poly2sym(coefs)) 4) Find the equation of the 3 rd degree polynomial that best fits the following data points using least squares regression: X = 10:15; Y = [1794 2454 3224 4259 5227 6438]; X = 10:15; Y = [1794 2454 3224 4259 5227 6438]; coefs = polyfit(X,Y,3); disp(coefs) %% converting to symbolic was kind of ugly 5) Find an equation for the following set of data. (Hint: plot on semilogy and loglog axes first, and then perform an appropriate linearization). X = 1:5;
Background image of page 1

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

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

This note was uploaded on 02/29/2012 for the course 440 127 taught by Professor Blase during the Fall '09 term at Rutgers.

Page1 / 4

14-440-127 Recitation 11 Problems- Solutions - 14:440:127-...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online