Matlab help Matlab help 1. (a) Compute arctan(e) and ln(i) using Matlab. (b) Fin
ID: 2966239 • Letter: M
Question
Matlab help
Matlab help 1. (a) Compute arctan(e) and ln(i) using Matlab. (b) Find out the largest prime factor of 20142015 using Matlab. 2. Use tic and toc to measure the time to multiply two random 1000x1000 matrices. 3. Compute 1+1/4+1/9+. ..+1/10000 using sum() function. 4. For a given matrix A. write down the command for the following operations. (a) Double the 3rd column of A. (b) Switch the 2nd row and the last row of A. (c) Replace all zero entries in A by 1. (d) Find the value of the largest entry in A. 5. (a) Create a matrix with diagonal entries 1,1/2,1/3,?. 1/100 and off-diagonal entries 1 (b) Create a 100x100 matrix with each row being 123 100Explanation / Answer
1a)
atan(exp(1));
log(1j);
2)
tic
a=rand(1000);
b=rand(1000);
an=a*b;
toc
3)
i=1:100;
f=1./(i.^2);
sum_f=sum(f);
disp(f)
4a)
A(:,3)=2*A(:,3);
4.b)
A([2,end],:)=A([end,2],:);
4.c)
A(A==0)=1;
4.d)
largest=max(max(A),[],1);