DeGracia_Miguel_19481379_Sec22_Lab6

# DeGracia_Miguel_19481379_Sec22_Lab6 - Miguel De Gracia...

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %% Miguel De Gracia. 19481379. Lab Assignment 6. Section 22 % %% Problem 1a % x=1:100; for k=1:length(x) X=x(k).^2; end e %% Problem 1b % x=20:-1:13; for k=1:length(x) X=log(x(k)); end e %% Problem 1c % type myfactorial myfactorial(8) m %% Problem 1d % type exp_app exp_app(2,4) exp_app(2,10) e %% Problem 1e % A = magic(6) %Creates a matrix with equal amount of rows and columns where the sum of %the rows and columns are equal, also applying to the diagonal of the %matrix created. The integers may vary from 1 to 6^2. I = [1:3 5:6]; %Creates a row vector 1x6, excluding the number 4. J = 6:-2:1; %Creates a row vector 1x3, [6 4 2] for i = I for j = J A(i,j) = - A(i,j); %Goes to the indices provided by i and j and makes that value %negative, it will do so for all j first once that is finished it %will go to the next i and do it for all j again. end end A %In the end, all the the rows, excluding the fourth row, in the columns %2,4, and 6, will now be negative. % %% Problem 2 % %DO PROBLEM 2 IT IS JUST EXPLAINING WHAT THE CODE DOES!!!! % %% Problem 3a %...
View Full Document

### Page1 / 4

DeGracia_Miguel_19481379_Sec22_Lab6 - Miguel De Gracia...

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

View Full Document
Ask a homework question - tutors are online