Question

In: Electrical Engineering

Activity description A program must be carried out in MATLAB or OCTAVE that acquires and analyzes...

Activity description

A program must be carried out in MATLAB or OCTAVE that acquires and analyzes (continuously or online) the voice signal that is acquired from the sound card of the PC (microphone input) or a signal that is acquired with an acquisition card of data (ex. NI DAQCard).

The program must continuously perform the functions: signal acquisition, spectral analysis of the acquired signal, graphs in the time domain and graphs in the frequency domain (magnitude and phase spectrum).

The program should display the following graphs:

1) Original signal in the time domain

2) Original signal in the frequency domain (magnitude and phase)

Program 1: Initially do not acquire the signal from the PC sound card, instead create a synthetic signal in the MATLAB workspace, for example a signal composed of the sum of two or more sinusoids of different amplitude, frequency and phase . The signal must be visualized in time (oscillations) and the frequency analysis (magnitude spectrum) must show the presence of the original frequencies. It is important to assume a certain sampling frequency and a duration of the synthetic signal.

Program 2: After this works, start with a static version of the voice signal analyzer (ie the input signal is only a defined time window, for example three seconds), i.e. program 2 is an improved version of program version 1 where instead of a synthetic signal the signal that is acquired with the sound card is used in a time range of for example 3s. Note that this frequency is acquired at a certain sampling frequency. Finally, make the necessary adaptations and changes to the version 1 program so that it works online or continuously.

Questions to answer:
1) What is the analysis in the frequency domain of a signal? What differences exist with respect to time domain
2) What is the FFT?
3) What type of signals (continuous or discrete) are being used in the program? Explain your answer.
4) Explain what the frequency spectrum of a signal is (remember that the frequency spectrum is two graphs).
5) According to the project, generally what type of signals do we find in nature (continuous or discrete) and what type of signals do computer systems use (continuous or discrete)?

Solutions

Expert Solution

%% Program 1

clear all;
close all;
clc;

Fs=5e3;
Ts=1/Fs;
t=0:Ts:1;
x=2*sin(100*2*pi*t)+cos(250*2*pi*t)+0.1*sin(500*2*pi*t);
plot(t,x)
xlim([0 0.05])
title('Synthetic Signal')

X=fft(x);
N=length(X);
dF = Fs/N;
Freq = -Fs/2:dF:Fs/2-dF;

figure();
subplot(2,1,1)
plot(Freq,20*log10(abs(X)/N));
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)')
title('Magnitude Plot');
subplot(2,1,2)
plot(Freq,180/(2*pi)*angle(X))
xlabel('Frequency (Hz)');
ylabel('Phase (degree)')
title('Phase Plot');

Output:

%% Program 2

clear all;
close all;
clc;

recorder = audiorecorder;
disp('Start speaking.')
recordblocking(recorder, 5);
disp('End of Recording.');
x = getaudiodata(recorder);
plot(x);

Fs=recorder.SampleRate;

X=fft(x);
N=length(X);
dF = Fs/N;
Freq = -Fs/2:dF:Fs/2-dF;

figure();
subplot(2,1,1)
plot(Freq,20*log10(abs(X)/N));
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)')
title('Magnitude Plot');
subplot(2,1,2)
plot(Freq,180/(2*pi)*angle(X))
xlabel('Frequency (Hz)');
ylabel('Phase (degree)')
title('Phase Plot');

Output:

NOTE: Output of the second program is dependent of each recording testcase.


Related Solutions

Write a full description of the importance and different types of fermentation carried out by bacteria.
Write a full description of the importance and different types of fermentation carried out by bacteria.
Programming assignment for ENSC 3213 NIM The program is to be written in Matlab. Program must...
Programming assignment for ENSC 3213 NIM The program is to be written in Matlab. Program must be liberally commented. The program is a game played by a human versus the machine. At the start, the prompt asks the human to enter three non-zero integers. These will constitute how many counters are in each Pile. The machine then asks who goes first. A turn consists of selecting a Pile and taking a number of counters from that pile. For example, if...
A program to decrease littering was carried out in four cities in California’s Central Valley starting...
A program to decrease littering was carried out in four cities in California’s Central Valley starting in August 2007. The amount of litter in the streets (average pounds of litter collected per block per day) was measured during July before the program started and then the next July, after the program had been in effect for a year. The results are as follows: City July 2007 July 2008 Fresno 9 2 Merced 10 4 Bakersfield 8 9 Stockton 9 1...
A project has five activities: A, B, C, and D, which must be carried out sequentially....
A project has five activities: A, B, C, and D, which must be carried out sequentially. The probability distributions of the number of weeks required to complete each of the activities A, B, and C are uniform in intervals [1,5], [2,3], and [3,6], respectively. The number of weeks required to complete activity D is a beta distribution with shape parameters a=2 and b=5, lower bound 2, and upper bound 10. Use simulation to forecast the total completion time of the...
HealthNut University’s Benefit Program This activity is important because as a manager, you must be able...
HealthNut University’s Benefit Program This activity is important because as a manager, you must be able to determine the most effective benefits to provide to your employees. There are many variables that impact the effectiveness of employee benefits. Evaluating your employees’ preferences, needs, the industry best practices and what the organization can afford are just a few. The goal of this activity is to demonstrate your understanding of the various types of benefits available to offer employees as well as...
Must be done in C Write a C program found out the maximum value between the...
Must be done in C Write a C program found out the maximum value between the three numbers? Show steps with comments or else it will be flagged.
Why must not-for-profit organizations determine when it is appropriate to allocate any cost for a joint activity among fund-raising, program, and administrative activities?
Why must not-for-profit organizations determine when it is appropriate to allocate any cost for a joint activity among fund-raising, program, and administrative activities?
Put yourself in an older person’s shoes. Imagine you are carrying out an everyday activity such as reading, eating, or talking when a nurse informs you that you must come with them.
Read the reflection, then answer the questions that follow.Put yourself in an older person’s shoes. Imagine you are carrying out an everyday activity such as reading, eating, or talking when a nurse informs you that you must come with them. Another person tells you they are about to push you, which they do. This person then instructs you to walk in a straight line. After that, you are expected to stand and then march with your eyes shut. At the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT