Advertisement
Guest User

cw06

a guest
Feb 20th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. %% prob1
  2. x = [0:.01:100]; %#ok<*NBRAK>
  3. y = [x.^2];
  4. y2 = [-x.^2+24*x];
  5. figure(1)
  6. plot(x,y)
  7. hold on
  8. plot(x,y2)
  9. xlabel('x')
  10. ylabel('y')
  11. title('x in relation to y')
  12. legend('y1','y2')
  13. grid on
  14. axis ([1 10 1 400])
  15. clear
  16. %% prob2
  17. x = rand (1,1000000);
  18. y = randn(1,1000000);
  19. figure(2)
  20. subplot(1,2,1)
  21. hist(x,20) %#ok<*HIST>
  22. subplot(1,2,2)
  23. hist(y,20)
  24. clear
  25. %% prob3
  26. R = 670;
  27. C = 1*10^(-6)';
  28. w = (1:.25:100000);
  29. G = ((sqrt(1+(w.^2).*(R^2)*(C^2))).^(-1));
  30. figure(3)
  31. semilogx(w,G)
  32. xlabel('frequency')
  33. ylabel('Gain')
  34. grid on
  35. clear
  36. %% prob4
  37. L = 15+.15*randn(10000,1);
  38. figure(4)
  39. subplot(1,3,1)
  40. hist(L,10)
  41. subplot(1,3,2)
  42. hist(L,40)
  43. subplot(1,3,3)
  44. hist(L,100)
  45. clear
  46. %% prob5
  47. x = 1:.001:100;
  48. y1 = x.^1;
  49. y2 = x.^2;
  50. y3 = x.^3;
  51. y4 = x.^4;
  52. y5 = x.^5;
  53. y6 = x.^6;
  54. figure(5)
  55. subplot(3,2,1)
  56. loglog(x,y1)
  57. grid on
  58. subplot(3,2,2)
  59. loglog(x,y2)
  60. grid on
  61. subplot(3,2,3)
  62. loglog(x,y3)
  63. grid on
  64. subplot(3,2,4)
  65. loglog(x,y4)
  66. grid on
  67. subplot(3,2,5)
  68. loglog(x,y5)
  69. grid on
  70. subplot(3,2,6)
  71. loglog(x,y6)
  72. grid on
  73. clear
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement