r2_yun - d=logspace(1,3,4 problem 3 x = linspace(0.988...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Recitation         40mins 40mins Practice Exercises 2.3 Page 23 2.3 2.6 2.10 2 3 40mins 40mins Practice Exercises 2.4 Page 30 2.8 2.12 2.17 Please save your work as yourname_rec1.m and upload it on sakai-> Dropbox
Image of page 1

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

View Full Document Right Arrow Icon
What does a.*b mean? a = [1 2 3 4]; % row vector b = [5 6 7 8]; a .* b = [5 12 21 32] % . means element by element % use . before * / \ ^
Image of page 2
What does a.*b mean? 1 2 3 4 5 6 7 8 9 a = 2 4 6 1 3 5 3 2 1 b = 1*2 2*4 3*6 .* 4*1 5*3 6*5 7*3 8*2 9*1 a b =
Image of page 3

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

View Full Document Right Arrow Icon
What does a.^2 mean? a = [1 2 3 4]; % row vector a .^ 2 = [1 4 9 16];
Image of page 4
triangle circle sphere cylinder
Image of page 5

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

View Full Document Right Arrow Icon
%% Problem 2.6 % a) Volume r=10; length=15; d=1; volume_sphere=4/3*pi*r^3; volume_bar=pi*(d/2)^2*length; total_volume=2*volume_sphere +volume_bar % b) Surface Area sa_sphere=4*pi*r^2; sa_bar=pi*d*length; total_sa=2*sa_sphere + sa_bar %% Problem 2.10 a=1:20 b=0:pi/10:2*pi c=linspace(4,20,15) d=logspace(1,3,4)
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: d=logspace(1,3,4) %% problem 3 x = linspace(0.988, 1.012, 241); y1 = x.^7 - 7*x.^6 + 21*x.^5 - 35*x.^4 + 35*x.^3 - 21*x.^2 + 7*x - 1; y2 = (x-1).^7; plot(x,y1,'b', x,y2,'r'); %% Practice Exercise 2.4 a=[2.3 5.8 9] sin(a) a+3 b=[5.2 3.14 2] a+b a.*b a.^2 c=0:10 d=0:2:10 linspace(10,20,6) logspace(1,2,5) %% Problem 2.12 g=9.8; t=0:10:100; d=1/2*g*t.^2; table=[t',d'] %% Problem 2.8 % a) r=3; h=[1,5,12]; volume = pi*r^2.*h % use the .* operator since h is an array % b) b=[ 2, 4, 6]; h=12; area=1/2*b.*h area=1./2.*b.*h % both works % c) h=6; volume=h.*area %% Problem 2.17 D=0:10:180; R=D*pi/180; D_to_R=[D',R'] save degrees.dat -ascii D_to_R %Check your current directory to confirm that the file was saved clear load degrees.dat degrees...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern