How can I subtract two WAV audio FFT signals?
Mostrar comentarios más antiguos
Hello MATLAB community,
Below, you will find 2 WAV files. One is the background noise and the other is the signal obtained during the experiment. I am interested in the 0-1000 Hz frequency range and as you can see in the below image, I figured out how to overlay 2 FFT's in 1 graph.
Now, I want to delete "noise FFT signal" from the "experimental FFT signal". Can I somehow subtract directly in the "Figure Window"? or I need to write an additional code?
In the example shown below, you can see a strong peak around 350 Hz, which I am looking at and by subtracting it from the background noise, I would get a smooth curve and obtain a raw experiment signal.
Finally, when I subtract 2 graphs, I could get just data points on the plot, which I want to join in a smooth line.
Thank you.
%clear, clc, close all
[y1,fs1]=audioread('Noise.wav');
t1=linspace(0,length(y1)/fs1,length(y1));
Nfft=8192;
% Nfft = length of fft
f1=linspace(0,fs1,Nfft);
X1=abs(fft(y1,Nfft));
%X = the fft of the samples y in 8192 points
plot(f1(1:Nfft/2),X1(1:Nfft/2))
xlim([0,1000])
%title('Combine Plots')
%2nd graph begins
hold on
[y2,fs2]=audioread('Experiment.wav');
t2=linspace(0,length(y1)/fs2,length(y1));
Nfft=8192;
% Nfft = length of fft
f2=linspace(0,fs2,Nfft);
X2=abs(fft(y2,Nfft));
%X = the fft of the samples y in 8192 points
plot(f2(1:Nfft/2),X2(1:Nfft/2))
xlabel('Frequency');
ylabel ('Amplitude');
title ('Background noise & experiment signals overlayed');
xlim([0,1000])
hold off

Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Spectral Estimation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!