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.
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section2.3: Data Types
Problem 5E
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
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![Operations Research : Applications and Algorithms](https://www.bartleby.com/isbn_cover_images/9780534380588/9780534380588_smallCoverImage.gif)
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole