rec10_vallillo_HW01

# rec10_vallillo_HW01 - Problem#1 disp'Problem#1 Answers...

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

Problem #1 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)) Problem #1 - Answers There are 5 days that the temperature in pond A is above 60 degrees. This happened on days 2, 4, 5, 6,and 7. The temperatures in pond A when it was greater than of equal to that of pond B were 55,62, 62, 59, 58and 56. Problem #2 >> 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) Problem #2 - Answers

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.