Question

In: Electrical Engineering

write the code in MATLAB with comments and show the inputs and results of the code...

write the code in MATLAB with comments and show the inputs and results of the code for the question below.

Write an .m file in MATLAB, that records audio (you can record your own voice for 20 seconds that was recorded using your phone), then take Fourier transform of the signal (probably FFT).

Solutions

Expert Solution

Code:

rec = audiorecorder(96000,16,1); %created object rec for audio recording with default parameters
recordblocking(rec, 20); %recording the sound using object for 20 s
play(rec); %play recoding recorded
y = getaudiodata(rec); %get the data recorded in double format
figure(1);
plot(y); %plot of the recorded signal
tsignal = fft(y,100); %taking fourier transform of the signal recorded

Recorded signal plot and code

Fourier transform tsignal values of recorded signal

1.0e-03 *

0.0916 + 0.0000i
0.0608 + 0.1852i
-0.0937 + 0.1253i
0.0001 - 0.0078i
-0.0057 + 0.0455i
0.0087 + 0.0389i
0.0563 + 0.1675i
0.0452 + 0.0339i
-0.0117 - 0.0227i
0.0199 + 0.0147i
0.0799 + 0.1298i
-0.0988 + 0.0347i
-0.0240 + 0.0199i
-0.0709 - 0.0312i
-0.0839 - 0.0908i
0.0547 + 0.0329i
0.2478 + 0.0672i
-0.0155 + 0.1462i
-0.0848 + 0.1223i
0.0424 + 0.0772i
0.0494 - 0.0802i
0.1771 + 0.0563i
0.1773 + 0.0464i
0.0106 + 0.0605i
-0.0011 + 0.0755i
0.2136 + 0.0610i
-0.0869 + 0.0435i
-0.1571 + 0.0323i
-0.0263 - 0.0156i
0.0265 - 0.0806i
0.0117 + 0.0802i
0.0754 + 0.0361i
-0.0967 + 0.0969i
-0.1392 + 0.0532i
0.0788 - 0.0232i
-0.0170 - 0.1550i
0.0127 - 0.0705i
0.1152 - 0.0328i
0.1007 + 0.0300i
-0.1123 + 0.0329i
-0.0189 - 0.1298i
-0.0654 - 0.0627i
-0.0523 + 0.0149i
0.0009 + 0.0472i
-0.0360 - 0.0346i
-0.1074 + 0.0832i
-0.0877 + 0.0550i
-0.0363 + 0.1218i
-0.1353 + 0.0099i
-0.0313 - 0.0847i
-0.0305 + 0.0000i
-0.0313 + 0.0847i
-0.1353 - 0.0099i
-0.0363 - 0.1218i
-0.0877 - 0.0550i
-0.1074 - 0.0832i
-0.0360 + 0.0346i
0.0009 - 0.0472i
-0.0523 - 0.0149i
-0.0654 + 0.0627i
-0.0189 + 0.1298i
-0.1123 - 0.0329i
0.1007 - 0.0300i
0.1152 + 0.0328i
0.0127 + 0.0705i
-0.0170 + 0.1550i
0.0788 + 0.0232i
-0.1392 - 0.0532i
-0.0967 - 0.0969i
0.0754 - 0.0361i
0.0117 - 0.0802i
0.0265 + 0.0806i
-0.0263 + 0.0156i
-0.1571 - 0.0323i
-0.0869 - 0.0435i
0.2136 - 0.0610i
-0.0011 - 0.0755i
0.0106 - 0.0605i
0.1773 - 0.0464i
0.1771 - 0.0563i
0.0494 + 0.0802i
0.0424 - 0.0772i
-0.0848 - 0.1223i
-0.0155 - 0.1462i
0.2478 - 0.0672i
0.0547 - 0.0329i
-0.0839 + 0.0908i
-0.0709 + 0.0312i
-0.0240 - 0.0199i
-0.0988 - 0.0347i
0.0799 - 0.1298i
0.0199 - 0.0147i
-0.0117 + 0.0227i
0.0452 - 0.0339i
0.0563 - 0.1675i
0.0087 - 0.0389i
-0.0057 - 0.0455i
0.0001 + 0.0078i
-0.0937 - 0.1253i
0.0608 - 0.1852i

Screenshot of these values obtained

screenshots are taken randomly.


Related Solutions

show the MATLAB Code with comments and Write an .m file in MATLAB, that records audio...
show the MATLAB Code with comments and Write an .m file in MATLAB, that records audio (you can record your own voice for 20 seconds), takes Fourier transform of the signal (probably FFT).
Write Matlab code (with detailed comments) to perform spectral analysis of 1KHz sine wave, noise and...
Write Matlab code (with detailed comments) to perform spectral analysis of 1KHz sine wave, noise and noise corrupted sine wave. Consider the sampling frequency Fs=10KHz.                                                                                                                                                   What should be the ideal frequency response of filter required to remove noise? Justify your answer                                                                                                                           
Write a user defined MATLAB program that performs power factor correction. The inputs to the MATLAB...
Write a user defined MATLAB program that performs power factor correction. The inputs to the MATLAB function should be voltage across the load (in Vrms, assume 0 phase), frequency Resistance of the load Inductance of the load power factor of the load target power factor The output of the function should be the size of the capacitor that one would need to place in parallel with the load to reach the target power factor. Please submit the code for the...
Write a MATLAB function named myaccel that accepts three inputs and has a single output. Inputs:...
Write a MATLAB function named myaccel that accepts three inputs and has a single output. Inputs: a list of time values a list of position values a single time value. Output: a single number which is obtained by numerically differentiating position with respect to time twice (forward difference method) and then interpolating the results based on the third input. Example: time=0:10; position=time.^3; myaccel(time,position,2.8) % should return 22.8
write code with proper comments for ever step the code should be in form of pseudocode                            &
write code with proper comments for ever step the code should be in form of pseudocode                                    To Print Triangle of any size, by taking size as input. To Print Triangle of any size, by taking size as input. If size is 4 then triangle is: To calculate Factorial of any number. To calculate the power of any given number. To Print Table of Any Number up till 10: as shown in this figure. for a program which reads 10 integers...
write a matlab code to simulate fiber optics communication system on matlab simulink
write a matlab code to simulate fiber optics communication system on matlab simulink
I'm new in MATLAB and I have to write a code in MATLAB which converts a...
I'm new in MATLAB and I have to write a code in MATLAB which converts a number from one base to another without using base2base, etc
1. Write code in mips that will play battleships. Include comments in code on what each...
1. Write code in mips that will play battleships. Include comments in code on what each part is doing.
**Add comments to existing ARM code to explain steps** Question that my code answers: Write an...
**Add comments to existing ARM code to explain steps** Question that my code answers: Write an ARM assembly program to calculate the value of the following function: f(y) = 3y^2 – 2y + 10 when y = 3. My Code below, that needs comments added: FunSolve.s LDR R6,=y LDR R1,[R6] MOV R2,#5 MOV R3,#6 MUL R4,R1,R1 MUL R4,R4,R2 MUL R5,R1,R3 SUB R4,R4,R5 ADD R4,R4,#8 st B st y DCD 3
1) a) Write a MATLAB function called Area1 having two inputs, r and N, and an...
1) a) Write a MATLAB function called Area1 having two inputs, r and N, and an output, A1. The output A1 should be the area under a curve, f(x), for x starting at x_start and ending at x_end. The input r should be a vector (array) having x_start and x_end as its two elements. The input N should be an integer equal to the number of equallength sub-intervals in which the interval from x_start to x_end should be divided. Here,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT