DeGracia_Miguel_19481379_lab2

DeGracia_Miguel_19481379_lab2 - Miguel De Gracia 19481379...

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

View Full Document Right Arrow Icon
%% Miguel De Gracia. 19481379. Lab Assignment 2. Section 22. % %% Problem 1 % a=linspace(16,48,9) b=[0.5:0.5:4.5]' b %% Problem 1 i % a./2 a %% Problem 1 ii % b+1 b %% Problem 1 iii % a.^3 a %% Problem 1 iv % a./b' a %% Problem 1 v % length(a) l %% Problem 1 vi % c=a(5) c %% Problem 1 vii % d=[a(6) a(4) a(2) a(5)] d %% Problem 1 viii % d_sorted=sort(d) d %% Problem 1 ix % disp(d(end)) d %% Problem 1 x % disp(b(end-1)) d %% Problem 1 xi % a_odd=[a(1:2:end)] a %% Problem 1 xii % b_even=[b(2:2:end)] b %% Problem 1 xiii %
Image of page 1

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

View Full Document Right Arrow Icon
a_rev=[a(end:-1:1)] a %% Problem 1 xiv % [d c] [ %% Problem 1 xv % [a ; b'] [ %% Problem 1 xvi % ind=find(b>3) i %% Problem 1 xvii % temp=d(find(d==c)) t %% Problem 2 % Phrase='ImaGinaTion is MorE imPOrTant thAn KnowlEDge'; P %% Problem 2 i % length(find(Phrase == 'a')) Phrase(find(Phrase == 'i')) P %% Problem 2 ii % length(find(Phrase == ' '))+1%The +1 accounts for the word at the end of the string because there is no space after that word. b %% Problem 2 iii % space_loc=find(Phrase == ' ') s %% Problem 2 iv % word4=Phrase(space_loc(3):space_loc(4)) w %% Problem 2 v % double('a')%gives the ASCII code for a, 97. double('A')%gives ASCII code for A, 65. char(97)%gives the letter that corresponds to the ASCII code 97. double('a') - double('A')% The numerical difference in ASCII code of both letters. 'a' - 'A'% The numerical difference in ASCII code of both letters.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the 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