Advertisement
BORUTO-121

playing_with_matrix(31)

Mar 6th, 2022
168
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clc;clear all;
  2. %%a) create vectors
  3. c=1:1:100;
  4. d=1:2:200;
  5. %%b)creating matrixes
  6. C=make10x10(c);
  7. D=make10x10(d);
  8. disp(C);disp(D);
  9.  
  10. %%c)submatrix
  11. E=C(3:5,5:8);
  12. disp(E);
  13. %%d)submatric with a step <>1
  14. F=D(2:2:8,1:3:7);
  15. disp(F);
  16. %%e)matrix multiplication
  17. G=E*F;
  18. e=diag(G);
  19. disp(e);
  20.  
  21. %%f)inversion and random numbers
  22. random_matrix=0+10*rand(3,3);
  23. H=G-random_matrix;
  24. disp(det(H));
  25. disp(inv(H));
  26.  
  27.  
  28. function [C]=make10x10(c)
  29.     j=1;
  30.     C=zeros(10);
  31.         for i=1:10
  32.             C(i,:)=c(j:j+9);
  33.             j=j+10;
  34.         end
  35. end
  36.  
  37.  
Advertisement
RAW Paste Data Copied
Advertisement