{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

14440127 PS 2- Solutions

# 14440127 PS 2- Solutions - 14:440:127 Introduction to...

This preview shows pages 1–3. Sign up to view the full content.

14:440:127- Introduction to Computers for Engineers Solutions to Problem Set 2 1) Problem 6.1 A: function N = num_grains(n) N = 2.^(n-1); B: num_grains(10:100) C: plot(10:100, num_grains(10:100)) 2) Problem 6.2 A: function E = energy(m) c = 2.9979*10^8; E = m*c^2; B: m = logspace(0,6,100); disp(energy(m)) C: m = logspace(0,6,100); subplot(2,2,1);plot(m, energy(m)) subplot(2,2,2);semilogx(m, energy(m)) subplot(2,2,3);semilogy(m, energy(m)) subplot(2,2,4);loglog(m, energy(m)) 3) Problem 6.3 A: function n = nmoles(m,MW) n = m./MW; B: [mgrid MWgrid] = meshgrid(1:10, [78.115 46.07 102.3]); n = nmoles(mgrid, MWgrid); 4) Problem 6.6 (for part a, return –inf if t<0) A: function h = height(t) if (t<0) h=-inf; else h = -9.8*t.^2 + 125*t +500; end B: time = 0:0.5:30; plot(time,height(time)) C: time = 0:0.5:30; [a b] = max(height(time)); disp(time(b))

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

View Full Document
5) Problem 6.10 Parts a,b,c A: pressure = @(h) 13560*9.8*h; B: Pa_to_atm = (p) p./101325; C: disp(Pa_to_atm(pressure(0.5:0.1:1))) 6) Problem 6.11 Parts a,b A: heat = (t) 1*1*t; B: cal_to_J = (c) 4.2*c; 7) Problem 8.18 x = [1 23 43 72 87 56 98 33]; s = 0; % running total of the sum for z = 1:length(x) s = s+x(z); end disp(s) 8) Problem 8.19 x = [1 23 43 72 87 56 98 33]; s = 0; % running total of the sum z=1; % step 1 while (z<=length(x)) %step 2 s = s+x(z);
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern