Communication systems are often subject to interference from a variety of source
ID: 2988279 • Letter: C
Question
Communication systems are often subject to interference from a variety of sources. In this project, you will use MATLAB to read a wav file, simulate the effect of narrowband interference and process the distorted signal to recover the original signal. You should write a MATLAB program that performs the following function.
Simulate the effect of interference. We will model the interference as being composed of 10 cosinusoid functions at frequencies 4500,4550,..,4950 Hz whose amplitudes are all Gaussian random variables with zero mean and variance 1/10. Play this through the speakers and observe that you can see the effect of interference. Plot the magnitude of the Fourier transform of the speech file with interference. You should see that the interference is dominant.
This is the code we have so far, it doesn't work. If someone could fix it, it would be great:
Explanation / Answer
I'll assume that you already have the nominal audio signal in the form of a single row vector (I'll call it "data") and the sampling frequency (how many data points per second, I'll call "fs").
You'll use randn() to generate the amplitude, and cos() to calculate the noise signals over time. Note that r = randn(100, 1).*stdevVal+meanVal produces a vector of 100 normally-distributed (Gaussian) random numbers with standard deviation stdevVal and mean of meanVal. Remember that sqrt(variance) = standard deviation.
You can do this one noise signal at a time, like so:
nPts = length(data); % Number of data points in signal
t = [1:nPts]./fs; % Time vector
noiseMean = 0;
noiseVar = 0.1;
noisyData = data; % Initialize to noiseless
for fn = 4500:50:4950 % Noise frequencies
noiseAmp = sqrt(noiseVar).*randn+noiseMean;
noise = noiseAmp.*cos(2.*pi.*fn.*t);
noisyData = noisyData+noise;
end
Or you could do the whole thing in one shot, which I think may be faster but more memory intensive:
nPts = length(data); % Number of data points in signal
fn = repmat([4500:50:4950]', 1, nPts); % Matrix of noise frequencies
nFn = length(fn);
t = repmat([1:nPts]./fs, nFn, 1); % Time vector tiled into a matrix
noiseMean = 0;
noiseVar = 0.1;
noiseAmp = repmat(sqrt(noiseVar).*randn(nFn, 1)+noiseMean, 1, nPts); % Matrix of noise amplitudes
noise = noiseAmp.*cos(2.*pi.*fn.*t); % Matrix of noise
noisyData = data+sum(noise, 1); % Add noise column-wise to original signal
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.