ENGR 126 Exam 3 Solution Spring 2008

ENGR 126 Exam 3 Solution Spring 2008 - or func_neg =...

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

View Full Document Right Arrow Icon
Exam 3 Answer Sheet ENGR 126 April 15, 2008 Name: Email: Seat: Div: Team #. ( Don't forget to answer the questions on the back. ) Problem #1 (8 points) Answer 6 64 Problem #2 (8 points) Answer x = 0; x = x+1; disp([x y]) disp('All done.') or lines 1,4,6,8 or all lines with "x" and "disp" Problem #3 (12 points) Answer tol = 0.01; err = 1000; y = 15; while abs(err) > tol y_old = y; y = my_func(y_old); err = y - y_old; end disp(y) disp(err) Problem #4 (16 points) (a) while…end for…end (b) while…end for…end (c) while…end for…end (d) while…end for…end Problem #5 (12 points) Answer Change the scale of the x-axis to a logarithmic scale or transform the data by computing log(x), then plot y vs. log(x) using a linear x-scale or Semilogx Problem #6 power function Problem #7 (8 points) Answer m = 2 b = 3
Background image of page 1

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

View Full DocumentRight Arrow Icon
( Don't forget to answer the questions on the front. ) Problem #8 (12 points) Solution: >> func_1='sin(x/5)^2*cos(x-1)' >> func_neg='-sin(x/5)^2*cos(x-1)'
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: or func_neg = ['-' func_1] >> xmax=fminbnd(func_neg,5,10) >> x=xmax or x = fminbnd(func_neg,5,10) >> max_amp=eval(func_1) Problem #9 (20 points) % UPS.m – A program to calculate the maximum volume that can be shipped via UPS % given the largest dimension of a package. % Input max_size = 165; % UPS constrains max length + girth 165 inches % Calculation for index = 1:1:8 % could use length = 35:10:105, but must compute consecutive index length(index) = 35 + 10*(index-1); % check lengths from 35-105 inches side(index) = (max_size – length(index))/4; % assuming square cross-section volume(index) = length(index)*side(index)^2; end index = 1; %Alternate solution for length = 35:10:105 side(index) = (max_size – length(index))/4; volume(index) = length(index)*side(index)^2; index = index + 1; end % Output plot(length,volume) title('Maximum UPS package volumes') ylabel('Package volume (cu in)') xlabel('Length of package (in)')...
View Full Document

This note was uploaded on 09/14/2009 for the course ENGR 126 taught by Professor Oakes during the Fall '08 term at Purdue.

Page1 / 2

ENGR 126 Exam 3 Solution Spring 2008 - or func_neg =...

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