1. Exercise 3 shows the non-zero-centered frequency results. Change the code of exercise 3 to display the zero-centered frequency results and submit the MATLAB programs.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please assist with coding this Matlab problem exercise. refer to both image for the question. Thank you.

Exercise 3: Using fft() function, plot the magnitude and phase of the sum of two sine waves.
clear;
close all;
t = 0:1/100:10-1/100;
x = sin(2*pi*15*t) + sin(2*pi*40*t);
figure (1)
plot(t, x)
y = fft(x);
% attention to the number of "y" vector
m = abs(y);
y(m<1e-6) = 8;
plot (f, m)
title('Magnitude')
ax = gca;
ax.XTick = [15 40 60 85];
% Whenever the jump between consecutive angles is greater than or equal to
% π radians, unwrap shifts the angles by adding multiples of ±2π until the
% jump is less than
p= unwrap (angle (y));
f = (0:length (y)-1)*100/length(y);
figure (2)
subplot (2,1,1)
subplot (2,1,2)
plot (f,p*180/pi)
title('Phase')
ax = gca;
ax.XTick= [15 40 60 85];
1.5 H
1
0.5
0
-0.5
-1
-1.5
0
600
400
200
100
50
0
-50
2
-100
15
% Time vector
% Signal
3
15
% Compute DFT of x
Figure (3): Sum of two sine waves in the time domain
% Magnitude
% Phase
% Frequency vector
40
5
40
6
Magnitude
Phase
60
7
60
8
85
9
85
10
Figure (4): Magnitude and phase of the sum of two sine waves
Transcribed Image Text:Exercise 3: Using fft() function, plot the magnitude and phase of the sum of two sine waves. clear; close all; t = 0:1/100:10-1/100; x = sin(2*pi*15*t) + sin(2*pi*40*t); figure (1) plot(t, x) y = fft(x); % attention to the number of "y" vector m = abs(y); y(m<1e-6) = 8; plot (f, m) title('Magnitude') ax = gca; ax.XTick = [15 40 60 85]; % Whenever the jump between consecutive angles is greater than or equal to % π radians, unwrap shifts the angles by adding multiples of ±2π until the % jump is less than p= unwrap (angle (y)); f = (0:length (y)-1)*100/length(y); figure (2) subplot (2,1,1) subplot (2,1,2) plot (f,p*180/pi) title('Phase') ax = gca; ax.XTick= [15 40 60 85]; 1.5 H 1 0.5 0 -0.5 -1 -1.5 0 600 400 200 100 50 0 -50 2 -100 15 % Time vector % Signal 3 15 % Compute DFT of x Figure (3): Sum of two sine waves in the time domain % Magnitude % Phase % Frequency vector 40 5 40 6 Magnitude Phase 60 7 60 8 85 9 85 10 Figure (4): Magnitude and phase of the sum of two sine waves
1. Exercise 3 shows the non-zero-centered frequency results. Change the code of exercise 3 to display the zero-centered
frequency results and submit the MATLAB programs.
Transcribed Image Text:1. Exercise 3 shows the non-zero-centered frequency results. Change the code of exercise 3 to display the zero-centered frequency results and submit the MATLAB programs.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education