Observation of the Effects of the Fourier Transformation on Periodic Signals ECE 521. Project 2

Similar documents
LABORATORY - FREQUENCY ANALYSIS OF DISCRETE-TIME SIGNALS

Discrete Fourier Transform (DFT)

Fourier Series and Gibbs Phenomenon

EE 215 Semester Project SPECTRAL ANALYSIS USING FOURIER TRANSFORM

Log Booklet for EE2 Experiments

Problem Set 1 (Solutions are due Mon )

G(f ) = g(t) dt. e i2πft. = cos(2πf t) + i sin(2πf t)

LAB 2 SPECTRUM ANALYSIS OF PERIODIC SIGNALS

Lab 4 Fourier Series and the Gibbs Phenomenon

Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

Fourier transforms, SIM

1. Let f(x, y) = 4x 2 4xy + 4y 2, and suppose x = cos t and y = sin t. Find df dt using the chain rule.

Topic 6. The Digital Fourier Transform. (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith)

Lab 6: Building a Function Generator

Fourier Signal Analysis

DFT: Discrete Fourier Transform & Linear Signal Processing

EE 422G - Signals and Systems Laboratory

ENGR 210 Lab 12: Sampling and Aliasing

Electrical & Computer Engineering Technology

Knowledge Integration Module 2 Fall 2016

ELT COMMUNICATION THEORY

Figure 1: Block diagram of Digital signal processing

Laboratory Assignment 4. Fourier Sound Synthesis

Lecture 3, Multirate Signal Processing

Signal segmentation and waveform characterization. Biosignal processing, S Autumn 2012

1. In the command window, type "help conv" and press [enter]. Read the information displayed.

Spectrum Analysis: The FFT Display

Notes on Fourier transforms

ECE 2111 Signals and Systems Spring 2012, UMD Experiment 9: Sampling

Principles of Communications ECS 332

Digital Signal Processing Fourier Analysis of Continuous-Time Signals with the Discrete Fourier Transform

The Discrete Fourier Transform. Claudia Feregrino-Uribe, Alicia Morales-Reyes Original material: Dr. René Cumplido

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

L A B 3 : G E N E R A T I N G S I N U S O I D S

Massachusetts Institute of Technology Dept. of Electrical Engineering and Computer Science Fall Semester, Introduction to EECS 2

Objectives. Abstract. This PRO Lesson will examine the Fast Fourier Transformation (FFT) as follows:

C.11 Sampling and Aliasing Solution

PART I: The questions in Part I refer to the aliasing portion of the procedure as outlined in the lab manual.

REAL-TIME PROCESSING ALGORITHMS

Mel Spectrum Analysis of Speech Recognition using Single Microphone

UNIVERSITY OF WARWICK

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

Physics 115 Lecture 13. Fourier Analysis February 22, 2018

Title: Pulse Amplitude Modulation.

Discrete Fourier Transform

Memorial University of Newfoundland Faculty of Engineering and Applied Science. Lab Manual

Identification of Nonstationary Audio Signals Using the FFT, with Application to Analysis-based Synthesis of Sound

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

Frequency Domain Representation of Signals

ECEGR Lab #8: Introduction to Simulink

Department of Electronic Engineering NED University of Engineering & Technology. LABORATORY WORKBOOK For the Course SIGNALS & SYSTEMS (TC-202)

DIGITAL SIGNAL PROCESSING CCC-INAOE AUTUMN 2015

ELEC3104: Digital Signal Processing Session 1, 2013

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

6 Sampling. Sampling. The principles of sampling, especially the benefits of coherent sampling

Lecture notes on Waves/Spectra Noise, Correlations and.

System analysis and signal processing

Chapter 5. Signal Analysis. 5.1 Denoising fiber optic sensor signal

Instruction Manual for Concept Simulators. Signals and Systems. M. J. Roberts

Fourier Transform. Any signal can be expressed as a linear combination of a bunch of sine gratings of different frequency Amplitude Phase

ME scope Application Note 02 Waveform Integration & Differentiation

CHAPTER 4 IMPLEMENTATION OF ADALINE IN MATLAB

B.Tech III Year II Semester (R13) Regular & Supplementary Examinations May/June 2017 DIGITAL SIGNAL PROCESSING (Common to ECE and EIE)

EEL 4350 Principles of Communication Project 2 Due Tuesday, February 10 at the Beginning of Class

Fourier Transform. Prepared by :Eng. Abdo Z Salah

SIGNALS AND SYSTEMS: 3C1 LABORATORY 1. 1 Dr. David Corrigan Electronic and Electrical Engineering Dept.

Signal Processing. Introduction

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering. EIE2106 Signal and System Analysis Lab 2 Fourier series

It is the speed and discrete nature of the FFT that allows us to analyze a signal's spectrum with MATLAB.

ECE 2713 Homework 7 DUE: 05/1/2018, 11:59 PM

The Scientist and Engineer's Guide to Digital Signal Processing By Steven W. Smith, Ph.D.

Experiment 8: Sampling

DCSP-10: DFT and PSD. Jianfeng Feng. Department of Computer Science Warwick Univ., UK

Wireless Communication Systems Laboratory Lab#1: An introduction to basic digital baseband communication through MATLAB simulation Objective

2.1 BASIC CONCEPTS Basic Operations on Signals Time Shifting. Figure 2.2 Time shifting of a signal. Time Reversal.

EE 470 BIOMEDICAL SIGNALS AND SYSTEMS. Active Learning Exercises Part 2

Window Method. designates the window function. Commonly used window functions in FIR filters. are: 1. Rectangular Window:

Advanced Audiovisual Processing Expected Background

EE 403: Digital Signal Processing

The Fourier Transform

Signal Processing. Naureen Ghani. December 9, 2017

LLS - Introduction to Equipment

CS4495/6495 Introduction to Computer Vision. 2C-L3 Aliasing

Lecture 2: SIGNALS. 1 st semester By: Elham Sunbu

ECE 301, final exam of the session of Prof. Chih-Chun Wang Saturday 10:20am 12:20pm, December 20, 2008, STEW 130,

Chapter 5 Window Functions. periodic with a period of N (number of samples). This is observed in table (3.1).

ELEC3104: Digital Signal Processing Session 1, 2013 LABORATORY 3: IMPULSE RESPONSE, FREQUENCY RESPONSE AND POLES/ZEROS OF SYSTEMS

MATLAB Assignment. The Fourier Series

Concordia University. Discrete-Time Signal Processing. Lab Manual (ELEC442) Dr. Wei-Ping Zhu

UNIVERSITY OF WARWICK

EE 438 Final Exam Spring 2000

Simulate IFFT using Artificial Neural Network Haoran Chang, Ph.D. student, Fall 2018

Design of FIR Filters

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

Hideo Okawara s Mixed Signal Lecture Series. DSP-Based Testing Fundamentals 13 Inverse FFT

MATLAB 6.5 Image Processing Toolbox Tutorial

ELEC MatLab Introductory Lab. Performed: Monday January 20 th Submitted: Monday January 27 th 2014

Sound synthesis with Pure Data

EEO 401 Digital Signal Processing Prof. Mark Fowler

Post-processing using Matlab (Advanced)!

Transcription:

Observation of the Effects of the Fourier Transformation on Periodic Signals ECE 521 Project 2 June 21, 2007

Abstract In this project we compared several signals with their Fourier Transforms in the frequency domain. Using MATLAB as the tool to make these comparisons six different waves were examined: an even square wave, a 60% pulse, a 20% pulse, a 10% pulse a triangular wave, and a cosine wave. Each of these waves were plotted in the time domain. This was then compared to the resulting plot from the Fourier transform applied to each signal. The purpose of this was to gain a better understanding of the relationship between the time and frequency domain of a signal. The next objective for was to zero-pad each of the above signals. This doubled the number of samples taken and artificially gave a better resolution of the signal in the frequency domain. This was shown by performing the Fourier Transform on these padded signals. Again graphs of the time and frequency domain of the signal were compared to note the effects of padding the signal and what is meant in each domain. Finally the values with the highest amplitude in the frequency domain were isolated, the top 20 and top 3, and then used to reconstruct the original signals. The results were then compared with the original signal for both padded and unpadded signals to determine the effects on accurate signal reconstruction.

Technical Discussion In order to get the signal in the frequency domain we implemented the fast Fourier transform (FFT) in MATLAB. The FFT is an efficient algorithm to compute the discrete Fourier transform and its inverse. Often used in signal processing MATLAB uses the following algorithms to compute the Fourier transform and it's inverse: N X k = j =1 x j Nj -1 k -1 N x j = 1/ N k = 1 X k - N j -1 k -1 where N =e - 2 i / N Some of the signals proved to be challenging to make in MATLAB because there was not a unit step function available. To overcome this we extensively used the abs command while limiting the time. Doing so allowed us to create what was essentially a unit step. We set boundaries for each signal in the time domain, to limit the output in our graphs to one period, and proceeded to plot our time domain functions and their Fourier Transforms. For the zero-padding, the zeros command was used to define an array with the same number of zeros as there was samples previously. This array was concatenated to the end of our signal function arrays. The effect of this was adding another period to the time domain equal to zero. The fast Fourier Transform was used once more to get our new padded frequency domain signals that appeared to be of higher resolution. To isolate the highest values in the frequency domain MATLAB s sort command was used to create a new array comprised of the absolute values of the signal function in the frequency domain in descending order. The 20th value was then taken from this array to determine the minimum value to keep from the signal array. The absolute value of the original signal for values greater than or equal to this minimum value was then taken, resulting in a signal composed of only the 20 highest values. The inverse fast Fourier transform (IFFT) of the signal with these 20 values was used to reconstruct each of the signals in the time domain. The same procedure was applied to the padded signals to obtain new signals with only the 20 highest values which were in turn reconstructed in the time domain. The three time domain signals, original, 20 highest, and padded 20 highest were then plotted together to compare the relative accuracy of the signal reconstruction. All of this was then repeated with only the top 3 values being used to reconstruct the signal.

Results Figure 1 displays our even square wave, and its Fourier Transform, the sinc function. Based on our knowledge of the subject, this was expected. When we look at Figure 2, a 60% pulse wave and its corresponding transform, we notice that in the time domain the signal holds the value 1 longer, and in the frequency domain the sinc function drops more slowly from its peak. Figure 3, for our 20% pulse, demonstrates this further as this sinc function has a wider base than our previous figures. This continues for our 10% pulse in figure 4. For our triangular wave in figure 5, we see that we are given a very steep sinc function in the frequency domain. In figure 6, our time domain cosine function gives a frequency domain signal of 2 impulses. The next group of figures displays the functions with their zero-padding. For Figure 7, our square wave goes through one period and then all its other values equal 0. As we look at our F.T., we notice that our signal s frequency doubled, and therefore increased the number of total frequencies at which it exists. These results are the same for all of the figures 7 through 12. The frequencies are doubled, and the total number of frequencies used by each function increases. Figure 13 shows our original square wave function, and two other similar graphs. The first shows the signal reconstructed from the 20 highest amplitude frequency values. Here we begin to see some overshooting of our original signal. Notice the last signal. It is zero-padded. This especially once it is supposed to go to zero, when it s reconstructed, has overshooting and error. Figure 14 shows similar, if smaller, issues with our 60% pulse, likely due to the fact that the original function is always positive. For Figure 15, our 20% pulse becomes smaller and smaller as it is reconstructed from 20, and then zeropadded and reconstructed. In Figure 16, the noticeable issues with the reconstructed signals are the same as with Figure 15. Figure 17 shows that our triangular wave is fairly well reconstructed for those values, even when zero-padded. We see that in Figure 18, our cosine signal was nearly perfectly reconstructed, until we tried with the padded signal, which caused it to warp in several places. Finally in the three-value reconstruction, our figures show more error and overshooting than above due to the extremely limited number of samples to reproduce the signal from. The square wave in Figure 19, once padded and reconstructed resembles a stepped sine function with diminished amplitude. Our pulses, 60%, 20%, and 10% and triangular wave, are all recreated as cosine and sine waves (cosine for the pulses, sine for the triangular) with lower amplitudes than their original signals. Lastly, our cosine function, while reconstructed nearly perfectly from the 3 samples, loses some of its amplitude when recreated from the padded signal. When constructed with 20 highest values and not 20 highest padded value the signal was closer to the original signal when reconstructed, as expected. On the triangle and cosine wave one can see how it may be beneficial to pad the wave, as the reconstruction was

relatively unaffected, but the increase in resolution was still present in the frequency domain allowing for a wider range of frequencies present. The construction with 3 highest padded values was not as good as the 20 highest values, again, as expected. It came close to accurately reconstructing the cosine and the triangle function even with these values. Many of the signals came out looking like the cosine function due to the lack of data from which to reconstruct the signal. From this lab we were able to learn the effects of padding and on what results it produces on different types of waves. Depending on what result we are looking for and the type of signal padding may or may not be a practical means of gaining a broader range of frequencies.

Data Figure 1 Figure 2

Figure 3 Figure 4

Figure 5 Figure 6

Figure 7 Figure 8

Figure 9 Figure 10

Figure 11 Figure 12

Figure 13 Figure 14

Figure 15 Figure 16

Figure 17 Figure 18

Figure 19 Figure 20

Figure 21 Figure 22

Figure 23 Figure 24

Code %---------------------------------------------------% Lab2 ECE 521 % Emily Cohen, Bharat Sharma, and Michael Barnes %---------------------------------------------------clc; clear all; close all; %1. Generate and plot 512 samples of the following periodic signals with %period 100 milliseconds (fs=5khz): %2. Use the FFT to compute the DFT of the above signals. Plot your results. n=512; %number of samples f=5000; %frequency t_min=0; t_max=0.1; %100 milliseconds t_step=(t_max-t_min)/n;% this divides the period up into n steps t=0:t_step:t_max-t_min-t_step; %1a. An even square wave time domain figure; y1a = (abs(t>=0 & t<=.05)-abs(t>.05 & t<=.1)); subplot(2,1,1),plot(t,y1a) title('an Even Square Wave'); %2a. An even square wave frequency domain Xf2a=fft(y1a); %the Fourier Transform is taken here Xf_shifta=fftshift(Xf2a); %shift Xf_absa=abs(Xf_shifta); %find magnitude Xf_norma=Xf_absa/max(Xf_absa); %normalize subplot(2,1,2), plot(xf_norma); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of an Even Square Wave'); %1b. A 60% pulse signal time domain figure; y1b = (abs(t>=0 & t<=.06)); subplot(2,1,1),plot(t,y1b) title('60% Duty Pulse Signal'); %2b. A 60% pulse signal frequency domain Xf2b=fft(y1b); %the Fourier Transform is taken here

Xf_shiftb=fftshift(Xf2b); %shift Xf_absb=abs(Xf_shiftb); %find magnitude Xf_normb=Xf_absb/max(Xf_absb); %normalize subplot(2,1,2),plot(xf_normb); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a 60% pulse signal'); %1c. A 20% pulse signal time domain figure; y1c = (abs(t>=0 & t<=.02)); subplot(2,1,1),plot(t,y1c) title('20% Duty Pulse Signal'); %2c. A 20% pulse signal frequency domain Xf2c=fft(y1c); %the Fourier Transform is taken here Xf_shiftc=fftshift(Xf2c); %shift Xf_absc=abs(Xf_shiftc); %find magnitude Xf_normc=Xf_absc/max(Xf_absc); %normalize subplot(2,1,2),plot(xf_normc); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a 20% pulse signal'); %1d. A 10% pulse signal time domain figure; y1d = (abs(t>=0 & t<=.01)); subplot(2,1,1),plot(t,y1d) title('10% Duty Pulse Signal'); %2d. A 10% pulse signal Xf2d=fft(y1d); %the Fourier Transform is taken here Xf_shiftd=fftshift(Xf2d); %shift Xf_absd=abs(Xf_shiftd); %find magnitude Xf_normd=Xf_absd/max(Xf_absd); %normalize subplot(2,1,2),plot(xf_normd); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a 10% pulse signal'); %1e. Triangular wave time domain figure; y1e = 20*t.*(abs(t>=0 & t<=.05))+(2-20*t).*(abs(t>.05 & t<=.1)); subplot(2,1,1),plot(t,y1e)

title('triangle Wave'); %2e. Triangular wave frequency domain Xf2e=fft(y1e); %the Fourier Transform is taken here Xf_shifte=fftshift(Xf2e); %shift Xf_abse=abs(Xf_shifte); %find magnitude Xf_norme=Xf_abse/max(Xf_abse); %normalize subplot(2,1,2),plot(xf_norme); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a Triangular Wave'); %1f. A cosine wave time domain figure; y1f=cos(2*pi*10*t); subplot(2,1,1),plot(t,y1f) title('cosine Wave') %2f. A cosine wave frequency domain Xf2f=fft(y1f); %the Fourier Transform is taken here Xf_shiftf=fftshift(Xf2f); %shift Xf_absf=abs(Xf_shiftf); %find magnitude Xf_normf=Xf_absf/max(Xf_absf); %normalize subplot(2,1,2),plot(xf_normf); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a Cosine Wave'); %3. Zero-pad the above signals with 512 zeros. Repeat Step 2 and comment on %your results. n=512; %half the number of samples f=5000; %frequency t_min=0; t_max=0.1; %100 milliseconds t_step=(t_max-t_min)/(2*n);%padded step sixe t=t_step*2:t_step*2:2*((t_max-t_min)); time=0:t_step*2:(t_max-t_min)-t_step; %3a. A padded even square wave time domain figure; y = (abs(time>=0 & time<=.05)-abs(time>.05 & time<=.1)); U=zeros(1,n); ya=[y,u]; subplot(2,1,1),plot(t,ya)

title('an Even Square Wave Padded with 512 Zeros'); %3a. A padded even square wave frequency domain Xf3a=fft(ya); %the Fourier Transform is taken here Xf_shifta=fftshift(Xf3a); %shift Xf_absa=abs(Xf_shifta); %find magnitude Xf_norma=Xf_absa/max(Xf_absa); %normalize subplot(2,1,2),plot(xf_norma); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a Padded Even Square Wave'); %3b. A padded 60% pulse signal time domain y = (abs(time>=0 & time<=.06)); yb = [y,u]; figure; subplot(2,1,1),plot(t,yb) title('60% Duty Pulse Signal Padded with 512 Zeros'); %3b. A padded 60% pulse signal frequency domain Xf3b=fft(yb); %the Fourier Transform is taken here Xf_shiftb=fftshift(Xf3b); %shift Xf_absb=abs(Xf_shiftb); %find magnitude Xf_normb=Xf_absb/max(Xf_absb); %normalize subplot(2,1,2),plot(xf_normb); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a Padded 60% pulse signal'); %3c. A padded 20% pulse signal time domain figure; y = (abs(time>=0 & time<=.02)); yc = [y,u]; subplot(2,1,1),plot(t,yc) title('20% Duty Pulse Signal Padded with 512 Zeros'); %3c. A padded 20% pulse signal frequency domain Xf3c=fft(yc); %the Fourier Transform is taken here Xf_shiftc=fftshift(Xf3c); %shift Xf_absc=abs(Xf_shiftc); %find magnitude Xf_normc=Xf_absc/max(Xf_absc); %normalize subplot(2,1,2),plot(xf_normc); xlabel('frequency (Hz)');

ylabel(' X(f) '); title('dft of a Padded 20% pulse signal'); %3d. A padded 10% pulse signal time domain figure; y = (abs(time>=0 & time<=.01)); yd = [y,u]; subplot(2,1,1),plot(t,yd) title('10% Duty Pulse Signal Padded with 512 Zeros'); %3d. A padded 10% pulse signal frequency domain Xf3d=fft(yd); %the Fourier Transform is taken here Xf_shiftd=fftshift(Xf3d); %shift Xf_absd=abs(Xf_shiftd); %find magnitude Xf_normd=Xf_absd/max(Xf_absd); %normalize subplot(2,1,2),plot(xf_normd); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a 10% pulse signal'); %3e. Padded triangular wave time domain figure; y = 20*time.*(abs(time>=0 & time<=.05))+(2-20*time).*(abs(time>.05 & time<=.1)); ye = [y,u]; subplot(2,1,1),plot(t,ye) title('triangle Wave'); %3e. Padded triangular wave frequency domain Xf3e=fft(ye); %the Fourier Transform is taken here Xf_shifte=fftshift(Xf3e); %shift Xf_abse=abs(Xf_shifte); %find magnitude Xf_norme=Xf_abse/max(Xf_abse); %normalize subplot(2,1,2),plot(xf_norme); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a Padded Triangular Wave'); %3f. A padded cosine wave time domain figure; y=cos(2*pi*10*time); yf = [y,u]; subplot(2,1,1),plot(t,yf) title('cosine Wave Padded with 512 Zeros')

%3f. A padded cosine wave frequency domain Xf3f=fft(yf); %the Fourier Transform is taken here Xf_shiftf=fftshift(Xf3f); %shift Xf_absf=abs(Xf_shiftf); %find magnitude Xf_normf=Xf_absf/max(Xf_absf); %normalize subplot(2,1,2),plot(xf_normf); xlabel('frequency (Hz)'); ylabel(' X(f) '); title('dft of a Padded Cosine Wave'); %4. Use 20 largest magnitude of the FFT to reconstruct the above signals. Plot %the original and the reconstructed signals. %4a. An even square wave figure subplot(3,1,1),plot(time,y1a) %plot original signal title('an Even Square Wave'); %Use only the 20 largest values sorta=sort(abs(xf2a),'descend'); %sort in descending order largea=sorta(20); %find the 20th largest value Xf2anew=Xf2a.*abs(abs(Xf2a)>=largea); % keep only values larger than the 20th value ya=ifft(xf2anew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,ya); %plot inverse from 20 values title('reconstructed from 20 Highest Values'); %Use only the 20 largest padded values sorta=sort(abs(xf3a),'descend'); %sort in descending order largea=sorta(20); %find the 20th largest value Xf3anew=Xf3a.*abs(abs(Xf3a)>=largea); % keep only values larger than the 20th value ya=ifft(xf3anew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,ya); %plot inverse from 20 padded values title('reconstructed from 20 Highest Padded Values'); %4b. A 60% pulse signal figure subplot(3,1,1),plot(time,y1b) %plot original signal

title('a 60% pulse signal'); %Use only the 20 largest values sortb=sort(abs(xf2b),'descend'); %sort in descending order largeb=sortb(20); %find the 20th largest value Xf2bnew=Xf2b.*abs(abs(Xf2b)>=largeb); % keep only values larger than the 20th value yb=ifft(xf2bnew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,yb); %plot inverse from 20 values title('reconstructed from 20 Highest Values'); %Use only the 20 largest padded values sortb=sort(abs(xf3b),'descend'); %sort in descending order largeb=sortb(20); %find the 20th largest value Xf3bnew=Xf3b.*abs(abs(Xf3b)>=largeb); % keep only values larger than the 20th value yb=ifft(xf3bnew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,yb); %plot inverse from 20 padded values title('reconstructed from 20 Highest Padded Values'); %4c A 20% pulse signal figure subplot(3,1,1),plot(time,y1c) %plot original signal title('a 20% pulse signal'); %Use only the 20 largest values sortc=sort(abs(xf2c),'descend'); %sort in descending order largec=sortc(20); %find the 20th largest value Xf2cnew=Xf2c.*abs(abs(Xf2c)>=largec); % keep only values larger than the 20th value yc=ifft(xf2cnew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,yc); %plot inverse from 20 values title('reconstructed from 20 Highest Values'); %Use only the 20 largest padded values sortc=sort(abs(xf3c),'descend'); %sort in descending order largec=sortc(20); %find the 20th largest value Xf3cnew=Xf3c.*abs(abs(Xf3c)>=largec); % keep only values larger than the 20th value

yc=ifft(xf3cnew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,yc); %plot inverse from 20 padded values title('reconstructed from 20 Highest Padded Values'); %4d A 10% pulse signal figure subplot(3,1,1),plot(time,y1d) %plot original signal title('a 10% pulse signal'); %Use only the 20 largest values sortd=sort(abs(xf2d),'descend'); %sort in descending order larged=sortd(20); %find the 20th largest value Xf2dnew=Xf2d.*abs(abs(Xf2d)>=larged); % keep only values larger than the 20th value yd=ifft(xf2dnew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,yd); %plot inverse from 20 values title('reconstructed from 20 Highest Values'); %Use only the 20 largest padded values sortd=sort(abs(xf3d),'descend'); %sort in descending order larged=sortd(20); %find the 20th largest value Xf3dnew=Xf3d.*abs(abs(Xf3d)>=larged); % keep only values larger than the 20th value yd=ifft(xf3dnew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,yd); %plot inverse from 20 padded values title('reconstructed from 20 Highest Padded Values'); %4e Triangle Wave figure subplot(3,1,1),plot(time,y1e) %plot original signal title('triangle Wave'); %Use only the 20 largest values sorte=sort(abs(xf2e),'descend'); %sort in descending order largee=sorte(20); %find the 20th largest value Xf2enew=Xf2e.*abs(abs(Xf2e)>=largee); % keep only values larger than the 20th value ye=ifft(xf2enew); %take the inverse Fourier Transform

subplot(3,1,2),plot(time,ye); %plot inverse from 20 values title('reconstructed from 20 Highest Values'); %Use only the 20 largest padded values sorte=sort(abs(xf3e),'descend'); %sort in descending order largee=sorte(20); %find the 20th largest value Xf3enew=Xf3e.*abs(abs(Xf3e)>=largee); % keep only values larger than the 20th value ye=ifft(xf3enew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,ye); %plot inverse from 20 padded values title('reconstructed from 20 Highest Padded Values'); %4f Cosine Wave figure subplot(3,1,1),plot(time,y1f) %plot original signal title('cosine Wave'); %Use only the 20 largest values sortf=sort(abs(xf2f),'descend'); %sort in descending order largef=sortf(20); %find the 20th largest value Xf2fnew=Xf2f.*abs(abs(Xf2f)>=largef); % keep only values larger than the 20th value yf=ifft(xf2fnew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,yf); %plot inverse from 20 values title('reconstructed from 20 Highest Values'); %Use only the 20 largest padded values sortf=sort(abs(xf3f),'descend'); %sort in descending order largef=sortf(20); %find the 20th largest value Xf3fnew=Xf3f.*abs(abs(Xf3f)>=largef); % keep only values larger than the 20th value yf=ifft(xf3fnew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,yf); %plot inverse from 20 padded values title('reconstructed from 20 Highest Padded Values'); %5. Repeat (4) using only the largest three coefficients.

%5a. An even square wave figure subplot(3,1,1),plot(time,y1a) %plot original signal title('an Even Square Wave'); %Use only the 3 largest values sorta=sort(abs(xf2a),'descend'); %sort in descending order largea=sorta(20); %find the 3rd largest value Xf2anew=Xf2a.*abs(abs(Xf2a)>=largea); % keep only values larger than the 3rd value ya=ifft(xf2anew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,ya); %plot inverse from 3 values title('reconstructed from 3 Highest Values'); %Use only the 3 largest padded values sorta=sort(abs(xf3a),'descend'); %sort in descending order largea=sorta(3); %find the 3rd largest value Xf3anew=Xf3a.*abs(abs(Xf3a)>=largea); % keep only values larger than the 3rd value ya=ifft(xf3anew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,ya); %plot inverse from 3 padded values title('reconstructed from 3 Highest Padded Values'); %5b. A 60% pulse signal figure subplot(3,1,1),plot(time,y1b) %plot original signal title('a 60% pulse signal'); %Use only the 3 largest values sortb=sort(abs(xf2b),'descend'); %sort in descending order largeb=sortb(3); %find the 3rd largest value Xf2bnew=Xf2b.*abs(abs(Xf2b)>=largeb); % keep only values larger than the 3rd value yb=ifft(xf2bnew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,yb); %plot inverse from 3 values title('reconstructed from 3 Highest Values');

%Use only the 3 largest padded values sortb=sort(abs(xf3b),'descend'); %sort in descending order largeb=sortb(3); %find the 3rd largest value Xf3bnew=Xf3b.*abs(abs(Xf3b)>=largeb); % keep only values larger than the 3rd value yb=ifft(xf3bnew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,yb); %plot inverse from 3 padded values title('reconstructed from 3 Highest Padded Values'); %5c A 20% pulse signal figure subplot(3,1,1),plot(time,y1c) %plot original signal title('a 20% pulse signal'); %Use only the 3 largest values sortc=sort(abs(xf2c),'descend'); %sort in descending order largec=sortc(3); %find the 3rd largest value Xf2cnew=Xf2c.*abs(abs(Xf2c)>=largec); % keep only values larger than the 3rd value yc=ifft(xf2cnew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,yc); %plot inverse from 3 values title('reconstructed from 3 Highest Values'); %Use only the 3 largest padded values sortc=sort(abs(xf3c),'descend'); %sort in descending order largec=sortc(3); %find the 3rd largest value Xf3cnew=Xf3c.*abs(abs(Xf3c)>=largec); % keep only values larger than the 3rd value yc=ifft(xf3cnew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,yc); %plot inverse from 3 padded values title('reconstructed from 3 Highest Padded Values'); %5d A 10% pulse signal figure subplot(3,1,1),plot(time,y1d) %plot original signal title('a 10% pulse signal');

%Use only the 3 largest values sortd=sort(abs(xf2d),'descend'); %sort in descending order larged=sortd(3); %find the 3rd largest value Xf2dnew=Xf2d.*abs(abs(Xf2d)>=larged); % keep only values larger than the 3rd value yd=ifft(xf2dnew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,yd); %plot inverse from 3 values title('reconstructed from 3 Highest Values'); %Use only the 3 largest padded values sortd=sort(abs(xf3d),'descend'); %sort in descending order larged=sortd(3); %find the 3rd largest value Xf3dnew=Xf3d.*abs(abs(Xf3d)>=larged); % keep only values larger than the 3rd value yd=ifft(xf3dnew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,yd); %plot inverse from 3 padded values title('reconstructed from 3 Highest Padded Values'); %5e Triangle Wave figure subplot(3,1,1),plot(time,y1e) %plot original signal title('triangle Wave'); %Use only the 3 largest values sorte=sort(abs(xf2e),'descend'); %sort in descending order largee=sorte(3); %find the 3rd largest value Xf2enew=Xf2e.*abs(abs(Xf2e)>=largee); % keep only values larger than the 3rd value ye=ifft(xf2enew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,ye); %plot inverse from 3 values title('reconstructed from 3 Highest Values'); %Use only the 3 largest padded values sorte=sort(abs(xf3e),'descend'); %sort in descending order largee=sorte(3); %find the 3rd largest value Xf3enew=Xf3e.*abs(abs(Xf3e)>=largee); % keep only values larger than the 3rd value ye=ifft(xf3enew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,ye); %plot inverse from 3 padded values

title('reconstructed from 3 Highest Padded Values'); %5f Cosine Wave figure subplot(3,1,1),plot(time,y1f) %plot original signal title('cosine Wave'); %Use only the 3 largest values sortf=sort(abs(xf2f),'descend'); %sort in descending order largef=sortf(3); %find the 3rd largest value Xf2fnew=Xf2f.*abs(abs(Xf2f)>=largef); % keep only values larger than the 3rd value yf=ifft(xf2fnew); %take the inverse Fourier Transform subplot(3,1,2),plot(time,yf); %plot inverse from 3 values title('reconstructed from 3 Highest Values'); %Use only the 3 largest padded values sortf=sort(abs(xf3f),'descend'); %sort in descending order largef=sortf(3); %find the 3rd largest value Xf3fnew=Xf3f.*abs(abs(Xf3f)>=largef); % keep only values larger than the 3rd value yf=ifft(xf3fnew); %take the inverse Fourier Transform subplot(3,1,3),plot(t,yf); %plot inverse from 3 padded values title('reconstructed from 3 Highest Padded Values');