Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Definición del Modelo
- f1 = 1100; % Frecuencia del tono generador 1 en Hertz
- f2 = 2900; % Frecuencia del tono generador 2 en Hertz
- Ts = 1/(40*max(f1,f2)); % Periodo de muestreo en Segundos
- dMic = 1; % Distancias entre micrófonos centrados en el origen, en metros
- dSrc = 10; % Distancias entre generadores de tonos centrados en el origen, en metros
- c = 340.29; % Velocidad del sonido en m/s
- % Gemerador de Tonos
- figure(1);
- t = [0:Ts:0.025];
- tone1 = sin(2*pi*f1*t);
- tone2 = sin(2*pi*f2*t);
- plot(t,tone1);
- hold on;
- plot(t,tone2,'r'); xlabel('time'); ylabel('amplitude'); axis([0 0.005 -1 1]); legend('tone 1', 'tone 2');
- hold off;
- % Mezclar tonos en microfonos
- % Asumir atenuación cuadrado inversa de intensidad de sonido
- figure(2);
- dNear = (dSrc - dMic)/2;
- dFar = (dSrc + dMic)/2;
- mic1 = 1/dNear*sin(2*pi*f1*(t-dNear/c)) + \
- 1/dFar*sin(2*pi*f2*(t-dFar/c));
- mic2 = 1/dNear*sin(2*pi*f2*(t-dNear/c)) + \
- 1/dFar*sin(2*pi*f1*(t-dFar/c));
- plot(t,mic1);
- hold on;
- plot(t,mic2,'r'); xlabel('time'); ylabel('amplitude'); axis([0 0.005 -1 1]); legend('mic 1', 'mic 2');
- hold off;
- % Uso de SVD para aislar las fuentes de sonido
- figure(3);
- x = [mic1' mic2'];
- [W,s,v]=svd((repmat(sum(x.*x,1),size(x,1),1).*x)*x');
- plot(t,v(:,1));
- hold on;
- maxAmp = max(v(:,1));
- plot(t,v(:,2),'r'); xlabel('time'); ylabel('amplitude'); axis([0 0.005 -maxAmp maxAmp]); legend('isolated tone 1', 'isolated tone 2');
- hold off;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement