Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help writing a short matlab script to do the following two things: The ma

ID: 3348452 • Letter: I

Question

I need help writing a short matlab script to do the following two things:

The matlab code i wrote already for the sound signal is below:

Number 6 is referring to the convolution function in the code i created below:

5. Add noise to the sound signal. Write a function that can accept any signal and a noise level, and returns the noise added to the signal. The noise level should be a percentage of the signal bound. 6. Create a function that removes the noise using the procedure used in P1.3 (part 1 number 3). You already decided what is the best value for T, which is a percentage of the period of the original signal.

Explanation / Answer

as per chegg rules we can answer only first one please ask 6th question again i will definetely answer it

Solution :

The following code adds noise to your signal.

%****************************************code

clc;
clear all;
close all;

fs=784;
frequency=392;
duration=50;
amp = 15;
values = [0:1/fs:duration];
mySound = amp*sin(2*pi*frequency*values);
max_val = max(abs(mySound));
mySound = mySound./max_val ;


filename = 'myAudioFile.wav';
audiowrite(filename,mySound,fs);
[tune ,fs] =audioread(filename);

%adding noise in this part
noise_energy = 0.08 ; %here you can tune this with respect to signal bound
noisySound =tune+ noise_energy * randn(length(tune), 1);
% Find out which sound they want to play:
promptMessage = sprintf('Which sound do you want to hear?');
titleBarCaption = 'Specify Sound';
button = questdlg(promptMessage, titleBarCaption, 'Perfect', 'Noisy', 'Perfect');
if strcmpi(button, 'Perfect')
   % Play the perfect sound.
display('Make sure your speakers are on.');
display('Playing the audio...');
sound(tune);
else
   % Play the noisy sound.
display('Make sure your speakers are on.');
display('Playing the audio...');
sound(noisySound);
end
%************

%*******************************************

thank you