rect10_vallillo_HW01

rect10_vallillo_HW01 - disp'Problem#1 Answers tem_A=[55 62...

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

View Full Document Right Arrow Icon
disp('Problem #1 - Answers') tem_A=[55 62 60 61 63 65 62 59 58 56];tem_B=[54 59 62 64 68 68 62 59 57 53]; fprintf('There are %1.0f days that the temperature in pond A is above 60 degrees.\n',sum(tem_A>60)) fprintf('This happened on days %1.0f,%2.0f,%3.0f,%4.0f,and %5.0f.\n',find(tem_A>60)) fprintf('The temperatures in pond A when it was greater than of equal to that of pond B were %1.0f,%2.0f,%3.0f,%4.0f,%5.0fand%6.0f.\n',tem_A(tem_A>=tem_B)) disp('Problem #2 - Answers') for x=[-5 3 15] if x<-1 y=exp(x+1);y6=y; y=2+cos(pi*x);y7=y; elseif x>=5 y=10*(x-5)+1;y8=y; end end x=[-5 3 15]; fprintf('When x=%1.0f, y=%.05f\n',x(1),y6) fprintf('When x=%1.0f, y=%1.0f\n',x(2),y7) fprintf('When x=%1.0f, y=%1.0f\n',x(3),y8) disp('Problem #3 - Answers') R=[55 62 60 61 63];v=[54 59 62 64 68]; fprintf('The current through resistor 1 is %.05f Ohms.\n',v(1)/R(1)) fprintf('The current through resistor 2 is %.05f Ohms.\n',v(2)/R(2)) fprintf('The current through resistor 3 is %.05f Ohms.\n',v(3)/R(3))
Background image of page 1

Info iconThis 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.

{[ snackBarMessage ]}

Page1 / 2

rect10_vallillo_HW01 - disp'Problem#1 Answers tem_A=[55 62...

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