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.
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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1296c196-158c-4a2c-9587-82b5996e9fed%2F1a9a9e51-e8eb-4232-9991-80a617b3d492%2Fsbporqh_processed.jpeg&w=3840&q=75)
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1296c196-158c-4a2c-9587-82b5996e9fed%2F1a9a9e51-e8eb-4232-9991-80a617b3d492%2Ftob5fem_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education