DeGracia_Miguel_19481379_lab2

DeGracia_Miguel_19481379_lab2 - Miguel De Gracia 19481379...

Info iconThis 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 %
Background image of page 1

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

View Full DocumentRight 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.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2010 for the course ENGINEERIN 7 taught by Professor Patzek during the Spring '08 term at Berkeley.

Page1 / 5

DeGracia_Miguel_19481379_lab2 - Miguel De Gracia 19481379...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online