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
100%

Please assist with coding this matlabb problem exercise. Need help with number 1, refer to both image. Thank you.

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.
2. The following fft result is too sparse to identify its frequency pattern. Make changes to the code below to get a higher
resolution of frequency (Hint: Exercise 6).
x = [-1, 1, -1, 2]; % original signal in time domain
X = fft(x);
magx = abs(X);
figure (1); subplot (3,1,1); stem (magx);
%% Fill in your code below
% total number of point: 32
subplot (3,1, 2); stem (magX32); axis ([1, 32,0,6])
title('Zero padding: total 32')
% total number of point: 64
subplot (3,1,3); stem (magX64); axis ([1,64,0,6])
title('Zero padding: total 64')
3
1.5
2
2.5
3
3.5
Figure (A): fft result is too sparse to identify its frequency pattern
4
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. 2. The following fft result is too sparse to identify its frequency pattern. Make changes to the code below to get a higher resolution of frequency (Hint: Exercise 6). x = [-1, 1, -1, 2]; % original signal in time domain X = fft(x); magx = abs(X); figure (1); subplot (3,1,1); stem (magx); %% Fill in your code below % total number of point: 32 subplot (3,1, 2); stem (magX32); axis ([1, 32,0,6]) title('Zero padding: total 32') % total number of point: 64 subplot (3,1,3); stem (magX64); axis ([1,64,0,6]) title('Zero padding: total 64') 3 1.5 2 2.5 3 3.5 Figure (A): fft result is too sparse to identify its frequency pattern 4
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
Expert Solution
steps

Step by step

Solved in 3 steps with 1 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.
Similar questions
  • SEE MORE QUESTIONS
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