{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lab0_assignment

# Lab0_assignment - Lab 0 Getting familiar with Matlab Name...

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

Lab 0 Getting familiar with Matlab Name: Paul Gonzales *** MY GRAPHS HAVE A GRAY BACKGROUND BECAUSE I USE A MAC Lab Session: W Submit date: EID: pag757 Question 1 B Question 2 How to get x, which (hint: function “inv”) Please provide your commands (paste them to the report with your answer) A = [1 3 2; 3 2 1; 2 1 3] b = [0.41;0.37;0.36] x = A\b x = 0.0500 0.0800 0.0600 OR x = inv(A)*b x = 0.0500 0.0800 0.0600 Question 3-4 Given a matrix A, (in order to answer these questions, I suggest you to try a matrix if you are not familiar with matlab, but explain with words, not numbers of your matrix) 3 what is the expression of deleting its 2 nd column? A( :,2) = [ ] 4 what does A (2:2:7) mean? Starting at the second element, displays every element by two’s each time to the seventh element Question 5-8, what functions do the following commands perform? Please comment them. Question 5 A = rand(4,5); %creates a 4 by 5 matrix of random entries normally distributed between 0 %and 1 Question 6 B=floor(A); %rounds the elements of A to the nearest integers less than or equal to A, basically %creates a matrix of the same size as A into 0’s Question 7 [m,n]=size(A); %returns the size of matrix A in separate variables m and n for i = 1:m %for i is in the first row for j=1:n % for j is in the first column; will iterate through entire matrix until end

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

View Full Document
Question 8 if B(i,j)==0 %if at any of these positions the number is zero sig = sig+1; %add one to a counter that counts number of zeros
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 8

Lab0_assignment - Lab 0 Getting familiar with Matlab Name...

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

View Full Document
Ask a homework question - tutors are online