RenHao

20150319_Pra

Mar 19th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.87 KB | None | 0 0
  1. 1.to create a serial number doesn't repeat
  2. N = fix(91*rand(1,10))+9
  3.  
  4. 2.to empty a row or col
  5. X=magic(4)
  6. X(3,:)=[]
  7.  
  8. 3.draw a tangent function
  9. t=-1.5:0.01:1.5
  10. y=tan(t);
  11. plot(t,y)
  12.  
  13. 4.
  14. t = 0:pi/10:2*pi;
  15. plot(exp(i*t),'-o') % -o : plot circle ; -s : plot square
  16. axis equal
  17. -------------
  18. t = 0:pi/10:2*pi;
  19. x=3*cos(t);
  20. y=3*sin(t);
  21. plot(x,y)
  22.  
  23. 5.
  24. save TD -ascii
  25.  
  26. 6.load image and flip it
  27.  load durer
  28.  X=(X/5);
  29.  image(X)
  30.  Y=fliplr(X);
  31.  image(Y)
  32.  
  33. 7.root for polynomial x^3 + x + 1 = 0
  34. p=[1,0,1,1];
  35. x=roots(p)
  36.  
  37. 8.find the numbers less than 0
  38. X=randn(4)
  39. size(X(find(X<0)),1)
  40. %k=find(X<0)
  41. %length(k)
  42.  
  43. 9.find eigenvalue and eigenvector for a matrix
  44. x=magic(3)
  45. y=eig(x)
  46. det(x)
  47. v = ones(3,1)
  48. x*v
  49.  
  50.  
  51. 10.
  52. for i =1:sqrt(int_v)
  53.         if 2^i >int_v
  54.             break
  55.         end
  56.     end
  57. i
  58. ------------------------------------
  59. n=1;
  60. p=2^n;
  61. while (x>p)
  62.     p=p*2;
  63.     n=n+1;
  64. end
  65. n
Advertisement
Add Comment
Please, Sign In to add comment