DeGracia_Miguel_19481379_Sec22_Lab6

DeGracia_Miguel_19481379_Sec22_Lab6 - % Miguel De Gracia....

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

View Full Document Right Arrow Icon
%% 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 % x=rand(4000,3000); y=zeros(size(x)); tic; t for i=1:4000
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
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 / 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 Right Arrow Icon
Ask a homework question - tutors are online