class3a_activity1

class3a_activity1 - Function B1matrix=Amatrix(1,:);...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ENGR 19500(II) Spring 2010 Activity 1 Activity 1. Command Function ?? >>Bvector=Amatrix(1,:) Extracts the first row of Amatrix >>Cvector=Amatrix(2,:) Extracts the second row of Amatrix >>Dvector=Amatrix(:,3) Extracts the third column of Amatrix >>sort(Dvector) Sorts the vector in ascending order >>Amatrix(3)= 30; >>Amatrix Changes (1,3) to 30 >>Evector= linspace(1,25,4) Creates four numbers between 1 and 25 with equal spacing >>Fvector=Evector*5 Multiplies Fvector with the scalar 5. >>Amatrix(1:2) Gives the first value of the second row and first row >>Amatrix(2:3) Gives the first value of the second and third row >>Amatrix(1:2,2:3) Gives the second and third values of the first and second rows Command (Method 1) Command (Method 2)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Function B1matrix=Amatrix(1,:); B3matrix=Amatrix(3,:); Bmatrix=[B1matrix; Bvector;B3matrix] Amatrix(2,1)=Bvector(1,1); Amatrix(2,2)=Bvector(1,2); Amatrix(2,3)=Bvector(1,3); Amatrix(2,4)=Bvector(1,4) Create a Bmatrix by replacing the middle row of Amatrix with the Bvector . Gvector=Amatrix(3,;) G1=Amatrix(3,1); G2=Amatrix(3,2); G3=Amatrix(3,3); G4=Amatrix(3,4); Gvector=[G1 G2 G3 G4] Create the Gvector by extracting the third row in Amatrix . Amatrix(2,3) A1=Amatrix(2,:); A2=A1(:,3) Extract row 2, column 3 from Amatrix Amatrix(1,1)=55 Replace the value 2 in Amatrix (row 1 and column 1) with the value 55. Amatrix(2,3)=0 Identify and remove the element in Amatrix(2,3) 1...
View Full Document

Ask a homework question - tutors are online