Advertisement
Guest User

matlab angelo

a guest
Nov 27th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.74 KB | None | 0 0
  1. %%
  2. A=[1 5 9; 2 6 10; 3 7 11; 4 8 12];
  3. B=[4 5 6; 3 2 1; 1 1 1];
  4. c=[1;3;5;7;];
  5. d=[0 2 4];
  6. A(2,3)
  7. B(2,3)
  8. c(2)
  9. d(3)
  10. [m,n]=size(A)
  11. x=length(d)
  12. A(:,1)
  13. A(:,2)
  14. A(:,3)
  15. A(:,2)=c
  16. clear B
  17. b1=[4;3;1]
  18. b2=[5;2;1]
  19. b3=[6;1;1]
  20. B=[b1 b2 b3]
  21. %%
  22. A=[1 5 9; 2 6 10; 3 7 11; 4 8 12];
  23. B=[4 5 6; 3 2 1; 1 1 1];
  24. c=[1;3;5;7;];
  25. d=[0 2 4];
  26. A(:,3)=c;
  27. B(2,:)=d;
  28. %%
  29. A=[1 5 9; 2 6 10; 3 7 11; 4 8 12];
  30. e=A(1,:);
  31. A(1,:)=A(4,:);
  32. A(4,:)=e;
  33. f=A(:,2);
  34. A(:,2)=A(:,3);
  35. A(:,3)=f
  36. %%
  37. A=[1 5 9;2 6 10;3 7 11;4 8 12;];
  38. B=[4 5 6;3 2 1;1 1 1];
  39. x=[1;1;1];
  40. a=[-1 0 1];
  41. A*x
  42. B*x
  43. A*B
  44. a*x
  45. x*a
  46. a*B
  47. %%
  48. A=[1 5 9;2 6 10;3 7 11;4 8 12;];
  49. x=[1;1;1];
  50. y=zeros(4,1);
  51. for i=1:4
  52.     s=0;
  53.     for j=1:3
  54.         s=s+A(i,j)*x(j);
  55.     end
  56.     y(i)=s;
  57. end
  58. y
  59. %%
  60. A=1 0 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement