• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Apr 24th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
2. %sound(m1,fs);
3. N = length(m1);
4. Ts = 1/fs;
5. t=(0:N-1)*Ts;
6. f=linspace(0,fs/2, (N/2) + 1);
7. nGraficos = 8;
8.
9. % m1 e s1
10. c1 = cos(2*pi*12000*t);
11. s1 = m1.*c1;
12.
13. subplot(nGraficos,1,1);
14. plot(t, m1);
15. title('m1(t)');
16. grid on;
17. xlim([0.72, 0.74]);
18.
19. subplot(nGraficos,1,2);
20. plot(t, s1);
21. title('s1(t)');
22. grid on;
23. xlim([0.72, 0.74]);
24.
25. % m2 e s2
26. c2 = sin(2*pi*12000*t);
27. s2 = m2.*c2;
28.
29. subplot(nGraficos,1,3);
30. plot(t, m2);
31. title('m2(t)');
32. grid on;
33. xlim([0.72, 0.74]);
34.
35. subplot(nGraficos,1,4);
36. plot(t, s2);
37. title('s2(t)');
38. grid on;
39. xlim([0.72, 0.74]);
40.
41. % M1 e S1
42. M1 = fftlab(m1);
43. subplot(nGraficos,1,5);
44. plot(f, abs(M1));
45. title('M1(f)');
46. grid on;
47. xlim([0, 18000]);
48.
49. S1 = fftlab(s1);
50. subplot(nGraficos,1,6);
51. plot(f, abs(S1));
52. title('S1(f)');
53. grid on;
54. xlim([0, 18000]);
55.
56.
57. % M2 e S2
58. M2 = fftlab(m2);
59. subplot(nGraficos,1,7);
60. plot(f, abs(M2));
61. title('M2(f)');
62. grid on;
63. xlim([0, 18000]);
64.
65. S2 = fftlab(s2);
66. subplot(nGraficos,1,8);
67. plot(f, abs(S2));
68. title('S2(f)');
69. grid on;
70. xlim([0, 18000]);
71.
72. % exercicio 2
73. figure(2);
74. nGraficosEx2 = 5;
75. s = s1 + s2;
76. v1 = s*2.*c1;
77. v2 = s*2.*c2;
78.
79. fcorte = 5500/(fs/2);
80. h = fir1(2000,fcorte);
81. [H, fh] = freqz(h,1,N/2+1,fs/1000) ;
82. H = abs(H);
83.
84. vo1 = filter(h,1,v1);
85. vo2 = filter(h,1,v2);
86.
87. S = fftlab(s);
88. subplot(nGraficosEx2,1,1);
89. plot(f, abs(S));
90. title('S(f)');
91. grid on;
92. xlim([0, 30000]);
93.
94. V1 = fftlab(v1);
95. subplot(nGraficosEx2,1,2);
96. plot(f, abs(V1));
97. title('V1(f)');
98. grid on;
99. xlim([0, 30000]);
100.
101. V2 = fftlab(v2);
102. subplot(nGraficosEx2,1,3);
103. plot(f, abs(V2));
104. title('V2(f)');
105. grid on;
106. xlim([0, 30000]);
107.
108. Vo1 = fftlab(vo1);
109. subplot(nGraficosEx2,1,4);
110. plot(f, abs(Vo1));
111. title('Vo1(f)');
112. grid on;
113. xlim([0, 30000]);
114.
115. Vo2 = fftlab(vo2);
116. subplot(nGraficosEx2,1,5);
117. plot(f, abs(Vo2));
118. title('Vo2(f)');
119. grid on;
120. xlim([0, 30000]);
121.
122. sound(m1, fs);
123. pause(3);
124. sound(vo1, fs);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top