Advertisement
Guest User

matlab

a guest
Oct 15th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. x = 4
  2. A = randi([5, 105], x, x)
  3.  
  4. p1 = 0
  5. p2 = 0
  6. p3 = 0
  7.  
  8. for i = 1:x
  9. for j = 1:x
  10. if A(i, j) < 25
  11. p1 = p1+1
  12. a(1, p1) = A(i, j)
  13. a(2, p1) = i
  14. a(3, p1) = j
  15.  
  16. elseif A(i, j) > 75
  17. p2 = p2+1
  18. b(1, p2) = A(i, j)
  19. b(2, p2) = i
  20. b(3, p2) = j
  21.  
  22. else
  23. p3 = p3+1
  24. c(1, p3) = A(i, j)
  25. c(2, p3) = i
  26. c(3, p3) = j
  27. end
  28. end
  29. end
  30.  
  31. figure(1)
  32. plot(a(1,:),'r*')
  33. hold on
  34. plot(b(1,:),'g*')
  35. hold on
  36. plot(c(1,:),'b*')
  37.  
  38.  
  39.  
  40.  
  41.  
  42. figure(1)
  43. t = [0:0.1:2*pi]
  44. a = 0.5*sin(t)
  45.  
  46. plot(t, a)
  47. hold on
  48.  
  49. figure(1)
  50. c = [0:0.1:2*pi]
  51. d = 1* sin(c)
  52. plot(c,d, 'r')
  53. hold on
  54.  
  55. figure(1)
  56. x = [0:0.1:2*pi]
  57. y = 2*sin(x)
  58. plot(x,y)
  59. hold on
  60.  
  61.  
  62.  
  63.  
  64. x = linspace(0, 2*pi)
  65. y = sin(x)
  66. z = cos(x)
  67. hold on
  68.  
  69. subplot(2, 1, 1)
  70. plot(x, y, 'r')
  71. title('sin x')
  72.  
  73. legend('y = sin x')
  74. xlabel('x')
  75. ylabel('y')
  76.  
  77. subplot(2, 1, 2, 'r')
  78. plot(x, z, 'm')
  79. title('cos x')
  80. legend('z = cos x')
  81. xlabel('x')
  82. ylabel('y')
  83.  
  84.  
  85.  
  86.  
  87. clear all;
  88. a=10;
  89. SNR_A=30;
  90. SNR_B=35;
  91. SNR_C=40;
  92.  
  93.  
  94. y1 = 10 ^ (SNR_A/10);
  95. y2 = 10 ^ (SNR_B/10);
  96. y3 = 10 ^ (SNR_C/10);
  97.  
  98. A = (1:1000)*1000;
  99. B = (2:1000)*1000;
  100. C = (3:1000)*1000;
  101.  
  102. D = A * log(1 +y1);
  103. E = B * log(1 +y2);
  104. F = C * log(1 +y3);
  105.  
  106. title('Kapacita prenosneho media')
  107. plot(D);
  108. hold on;
  109. plot(E);
  110. hold on;
  111. plot(F);
  112. legend({'30db', '35db','40db'}, 'location', 'northwest');
  113. xlabel('Sirka pasma B')
  114. ylabel('Kapacita kanala C')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement