SlideShare a Scribd company logo
Lab Task 2 Syed Abuzar DSP
1
Lab Report:
Submitted By :
Syed Abuzar Hussain Shah
Reg #
SP15-BEE-096
Submitted To:
Sir Usman
Class:
BEE-5A
Dated: 30/03/2017
Lab Task 2 Syed Abuzar DSP
2
Introduction:
In today’s Lab we will take a continuous time signal and sample it out with a fixed
sampling time
period and analyze its frequency response at each point.
Commands to be used:
• plot
• real
• exp
• imag
• Abs
• phase
• diff
• sin/cos
• hold on/off
Task:
Take a continuous time sinusoidal with a cut off frequency of 50 Hz with a
simulated sampling
frequency of 1000. Analyse its frequency spectrum using “fft”.
clc
clear all
close all
fn=50;
fs=1000;
N=1200;
t=(-100:100)*1/fs;
x=sin(2*pi*fn*t);
subplot(241)
plot(t*1000,x)
title(['fn = ' num2str(fn) 'Hz fs = ' num2str(fs) 'Hz'])
ylabel('x(t)')
xlabel('ms')
axis([-30 30 -2 2])
grid on;
Lab Task 2 Syed Abuzar DSP
3
fsq=2*fn;
x1=square(2*pi*fsq*t);
subplot(242)
plot(t*1000,x1)
axis([-30 30 -2 2])
title(['fsq = ' num2str(fsq) 'Hz'])
ylabel('x1(t)')
xlabel('ms')
grid on;
imp=abs(diff(x1))/2;
subplot(243)
stem(t*1000,[imp 0])
title(['impulse'])
ylabel(' delta(t)')
xlabel('ms')
axis([-30 30 -1 3])
grid on;
k=1;
for i=1:length(imp)
if(imp(i)==1)
y(i)=imp(i)*x(i);
z(k)=y(i);
k=k+1;
end
end
subplot(244)
stem(t*1000,[y 0])
hold on;
plot(t*1000,x,'r');
title(['Sampled Data'])
ylabel(' y(t)=x(t).delta(t)')
xlabel('ms')
axis([-30 30 -2 2])
grid on;
om=linspace(-fs/2,fs/2,N);
Lab Task 2 Syed Abuzar DSP
4
h=fft(x,N);
z=fftshift(h);
subplot(245)
plot(om,abs(z))
title(['fft of sinosidal wave'])
ylabel(' |X(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(x1,N);
z=fftshift(h);
subplot(246)
plot(om,abs(z))
title(['fft of square wave'])
ylabel(' |X1(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(imp,N);
z=fftshift(h);
subplot(247)
plot(om,abs(z))
title(['fft of impulse'])
ylabel(' |S(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(y,N);
z=fftshift(h);
subplot(248)
plot(om/(2*fsq*pi),abs(z))
title(['fft of Y(jOmega)'])
ylabel(' Y(jOmega)=X(jOmega)*S(jOmega)')
xlabel('Omega(rad/sec)')
grid on;
Lab Task 2 Syed Abuzar DSP
5
Output:
Now generate a square wave with frequency “3fn/2” and repeat all steps.
clc
clear all
close all
fn=50;
fs=1000;
N=1200;
t=(-100:100)*1/fs;
x=sin(2*pi*fn*t);
subplot(241)
plot(t*1000,x)
title(['fn = ' num2str(fn) 'Hz fs = ' num2str(fs) 'Hz'])
ylabel('x(t)')
xlabel('ms')
axis([-30 30 -2 2])
grid on;
fsq=(3*fn)/2;
x1=square(2*pi*fsq*t);
subplot(242)
Lab Task 2 Syed Abuzar DSP
6
plot(t*1000,x1)
axis([-30 30 -2 2])
title(['fsq = ' num2str(fsq) 'Hz'])
ylabel('x1(t)')
xlabel('ms')
grid on;
imp=abs(diff(x1))/2;
subplot(243)
stem(t*1000,[imp 0])
title(['impulse'])
ylabel(' delta(t)')
xlabel('ms')
axis([-30 30 -1 3])
grid on;
k=1;
for i=1:length(imp)
if(imp(i)==1)
y(i)=imp(i)*x(i);
z(k)=y(i);
k=k+1;
end
end
subplot(244)
stem(t*1000,[y 0])
hold on;
plot(t*1000,x,'r');
title(['Sampled Data'])
ylabel(' y(t)=x(t).delta(t)')
xlabel('ms')
axis([-30 30 -2 2])
grid on;
om=linspace(-fs/2,fs/2,N);
h=fft(x,N);
z=fftshift(h);
subplot(245)
plot(om,abs(z))
Lab Task 2 Syed Abuzar DSP
7
title(['fft of sinosidal wave'])
ylabel(' |X(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(x1,N);
z=fftshift(h);
subplot(246)
plot(om,abs(z))
title(['fft of square wave'])
ylabel(' |X1(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(imp,N);
z=fftshift(h);
subplot(247)
plot(om,abs(z))
title(['fft of impulse'])
ylabel(' |S(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(y,N);
z=fftshift(h);
subplot(248)
plot(om/(2*fsq*pi),abs(z))
title(['fft of Y(jOmega)'])
ylabel(' Y(jOmega)=X(jOmega)*S(jOmega)')
xlabel('Omega(rad/sec)')
grid on;
Lab Task 2 Syed Abuzar DSP
8
Output:
Now generate a square wave with frequency “5fn” and repeat all steps.
clc
clear all
close all
fn=50;
fs=1000;
N=1200;
t=(-100:100)*1/fs;
x=sin(2*pi*fn*t);
subplot(241)
plot(t*1000,x)
title(['fn = ' num2str(fn) 'Hz fs = ' num2str(fs) 'Hz'])
ylabel('x(t)')
xlabel('ms')
axis([-30 30 -2 2])
grid on;
fsq=5*fn;
x1=square(2*pi*fsq*t);
Lab Task 2 Syed Abuzar DSP
9
subplot(242)
plot(t*1000,x1)
axis([-30 30 -2 2])
title(['fsq = ' num2str(fsq) 'Hz'])
ylabel('x1(t)')
xlabel('ms')
grid on;
imp=abs(diff(x1))/2;
subplot(243)
stem(t*1000,[imp 0])
title(['impulse'])
ylabel(' delta(t)')
xlabel('ms')
axis([-30 30 -1 3])
grid on;
k=1;
for i=1:length(imp)
if(imp(i)==1)
y(i)=imp(i)*x(i);
z(k)=y(i);
k=k+1;
end
end
subplot(244)
stem(t*1000,[y 0])
hold on;
plot(t*1000,x,'r');
title(['Sampled Data'])
ylabel(' y(t)=x(t).delta(t)')
xlabel('ms')
axis([-30 30 -2 2])
grid on;
om=linspace(-fs/2,fs/2,N);
h=fft(x,N);
z=fftshift(h);
subplot(245)
Lab Task 2 Syed Abuzar DSP
10
plot(om,abs(z))
title(['fft of sinosidal wave'])
ylabel(' |X(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(x1,N);
z=fftshift(h);
subplot(246)
plot(om,abs(z))
title(['fft of square wave'])
ylabel(' |X1(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(imp,N);
z=fftshift(h);
subplot(247)
plot(om,abs(z))
title(['fft of impulse'])
ylabel(' |S(jOmega)|')
xlabel('Omega(rad/sec)')
grid on;
h=fft(y,N);
z=fftshift(h);
subplot(248)
plot(om/(2*fsq*pi),abs(z))
title(['fft of Y(jOmega)'])
ylabel(' Y(jOmega)=X(jOmega)*S(jOmega)')
xlabel('Omega(rad/sec)')
grid on;
Lab Task 2 Syed Abuzar DSP
11
Output:
Questions:
Q1. Provide your analysis for the changed frequency of Impulse train.
Ans: When we change the frequency of the square wave, the frequency of impulse
train also changes. When frequency of impulse train increases, number of samples
taken also increases so more information is stored.
Q2: Explain if you observe under or over sampling .
Ans: When I took samples according to Niquous Criteria (fsq=2fn), I observed
over sampling (fsq=5fn) but when I taken fsq=1.5fn I observed under sampling.In
Over sampling no data is lost but in under sampling we lose information.
Conclusion:
In this lab I learnt the difference between the oversampling and undersampling.
The frequency of impulse train has main role in under and over sampling. If
frequency is increased, sampling time also increases so we have more information
about the signal.

More Related Content

What's hot

C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략 C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략
명신 김
 
型理論 なんて自分には関係ないと思っているあなたへ
型理論 なんて自分には関係ないと思っているあなたへ型理論 なんて自分には関係ないと思っているあなたへ
型理論 なんて自分には関係ないと思っているあなたへ
Yusuke Matsushita
 
Java Time Puzzlers
Java Time PuzzlersJava Time Puzzlers
Java Time Puzzlers
Eric Jain
 
Lec06
Lec06Lec06
Ecg programa simulado
Ecg programa simuladoEcg programa simulado
Ecg programa simulado
Eduard Stiven Marin Montoya
 
Building Efficient and Highly Run-Time Adaptable Virtual Machines
Building Efficient and Highly Run-Time Adaptable Virtual MachinesBuilding Efficient and Highly Run-Time Adaptable Virtual Machines
Building Efficient and Highly Run-Time Adaptable Virtual Machines
Guido Chari
 
Original NPN Transistor KTC3875S-Y-RTK 150mA 60V SOT-23 ALO ALY SMD Code New
Original NPN Transistor KTC3875S-Y-RTK 150mA 60V SOT-23 ALO ALY SMD Code NewOriginal NPN Transistor KTC3875S-Y-RTK 150mA 60V SOT-23 ALO ALY SMD Code New
Original NPN Transistor KTC3875S-Y-RTK 150mA 60V SOT-23 ALO ALY SMD Code New
authelectroniccom
 
A Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with MultithreadingA Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with Multithreading
Matsuo and Tsumura lab.
 
Ray tracing with ZIO-ZLayer
Ray tracing with ZIO-ZLayerRay tracing with ZIO-ZLayer
Ray tracing with ZIO-ZLayer
Pierangelo Cecchetto
 
Ray Tracing with ZIO
Ray Tracing with ZIORay Tracing with ZIO
Ray Tracing with ZIO
Pierangelo Cecchetto
 
Introduction of GPS BPSK-R and BOC
Introduction of GPS BPSK-R and BOCIntroduction of GPS BPSK-R and BOC
Introduction of GPS BPSK-R and BOC
Pei-Che Chang
 
第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -
Wataru Kani
 
PSpice Simulation Resault
PSpice Simulation ResaultPSpice Simulation Resault
PSpice Simulation Resault
Tsuyoshi Horigome
 
How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJIT
Egor Bogatov
 
Jan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoopJan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoop
Yahoo Developer Network
 
Sheet with useful_formulas
Sheet with useful_formulasSheet with useful_formulas
Sheet with useful_formulas
Hoopeer Hoopeer
 
4 Type conversion functions
4 Type conversion functions4 Type conversion functions
4 Type conversion functions
Docent Education
 

What's hot (17)

C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략 C++ AMP 실천 및 적용 전략
C++ AMP 실천 및 적용 전략
 
型理論 なんて自分には関係ないと思っているあなたへ
型理論 なんて自分には関係ないと思っているあなたへ型理論 なんて自分には関係ないと思っているあなたへ
型理論 なんて自分には関係ないと思っているあなたへ
 
Java Time Puzzlers
Java Time PuzzlersJava Time Puzzlers
Java Time Puzzlers
 
Lec06
Lec06Lec06
Lec06
 
Ecg programa simulado
Ecg programa simuladoEcg programa simulado
Ecg programa simulado
 
Building Efficient and Highly Run-Time Adaptable Virtual Machines
Building Efficient and Highly Run-Time Adaptable Virtual MachinesBuilding Efficient and Highly Run-Time Adaptable Virtual Machines
Building Efficient and Highly Run-Time Adaptable Virtual Machines
 
Original NPN Transistor KTC3875S-Y-RTK 150mA 60V SOT-23 ALO ALY SMD Code New
Original NPN Transistor KTC3875S-Y-RTK 150mA 60V SOT-23 ALO ALY SMD Code NewOriginal NPN Transistor KTC3875S-Y-RTK 150mA 60V SOT-23 ALO ALY SMD Code New
Original NPN Transistor KTC3875S-Y-RTK 150mA 60V SOT-23 ALO ALY SMD Code New
 
A Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with MultithreadingA Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with Multithreading
 
Ray tracing with ZIO-ZLayer
Ray tracing with ZIO-ZLayerRay tracing with ZIO-ZLayer
Ray tracing with ZIO-ZLayer
 
Ray Tracing with ZIO
Ray Tracing with ZIORay Tracing with ZIO
Ray Tracing with ZIO
 
Introduction of GPS BPSK-R and BOC
Introduction of GPS BPSK-R and BOCIntroduction of GPS BPSK-R and BOC
Introduction of GPS BPSK-R and BOC
 
第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -
 
PSpice Simulation Resault
PSpice Simulation ResaultPSpice Simulation Resault
PSpice Simulation Resault
 
How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJIT
 
Jan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoopJan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoop
 
Sheet with useful_formulas
Sheet with useful_formulasSheet with useful_formulas
Sheet with useful_formulas
 
4 Type conversion functions
4 Type conversion functions4 Type conversion functions
4 Type conversion functions
 

Similar to Sampling

Reconstruction
ReconstructionReconstruction
Reconstruction
COMSATS Abbottabad
 
Matlab 2
Matlab 2Matlab 2
Matlab 2
asguna
 
Dsp Lab Record
Dsp Lab RecordDsp Lab Record
Dsp Lab Record
Aleena Varghese
 
DSP LAB COMPLETE CODES.docx
DSP LAB COMPLETE CODES.docxDSP LAB COMPLETE CODES.docx
DSP LAB COMPLETE CODES.docx
MUMAR57
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1
Janardhana Raju M
 
Numerical Algorithm for a few Special Functions
Numerical Algorithm for a few Special FunctionsNumerical Algorithm for a few Special Functions
Numerical Algorithm for a few Special Functions
Amos Tsai
 
Multirate sim
Multirate simMultirate sim
Multirate sim
Alim Sheikh
 
Dsp manual
Dsp manualDsp manual
Dsp manual
pramod naik
 
FFT
FFTFFT
EC8553 Discrete time signal processing
EC8553 Discrete time signal processing EC8553 Discrete time signal processing
EC8553 Discrete time signal processing
ssuser2797e4
 
Compte rendu com op touati
Compte rendu com op touatiCompte rendu com op touati
Compte rendu com op touati
hamdinho
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
Abi finni
 
Capitulo 12, 7ma edición
Capitulo 12, 7ma ediciónCapitulo 12, 7ma edición
Capitulo 12, 7ma edición
Sohar Carr
 
Matlab fair-record-model
Matlab fair-record-modelMatlab fair-record-model
Matlab fair-record-model
ajaydev1111
 
Dsp iit workshop
Dsp iit workshopDsp iit workshop
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
OdessaFrontend
 
NWD the73js.pptx
NWD the73js.pptxNWD the73js.pptx
NWD the73js.pptx
Hanokh Aloni
 
Ecg
EcgEcg
Ecg
toi_sat
 
SolutionsPlease see answer in bold letters.Note pi = 3.14.docx
SolutionsPlease see answer in bold letters.Note pi = 3.14.docxSolutionsPlease see answer in bold letters.Note pi = 3.14.docx
SolutionsPlease see answer in bold letters.Note pi = 3.14.docx
rafbolet0
 
Dsp manual
Dsp manualDsp manual

Similar to Sampling (20)

Reconstruction
ReconstructionReconstruction
Reconstruction
 
Matlab 2
Matlab 2Matlab 2
Matlab 2
 
Dsp Lab Record
Dsp Lab RecordDsp Lab Record
Dsp Lab Record
 
DSP LAB COMPLETE CODES.docx
DSP LAB COMPLETE CODES.docxDSP LAB COMPLETE CODES.docx
DSP LAB COMPLETE CODES.docx
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1
 
Numerical Algorithm for a few Special Functions
Numerical Algorithm for a few Special FunctionsNumerical Algorithm for a few Special Functions
Numerical Algorithm for a few Special Functions
 
Multirate sim
Multirate simMultirate sim
Multirate sim
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 
FFT
FFTFFT
FFT
 
EC8553 Discrete time signal processing
EC8553 Discrete time signal processing EC8553 Discrete time signal processing
EC8553 Discrete time signal processing
 
Compte rendu com op touati
Compte rendu com op touatiCompte rendu com op touati
Compte rendu com op touati
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
 
Capitulo 12, 7ma edición
Capitulo 12, 7ma ediciónCapitulo 12, 7ma edición
Capitulo 12, 7ma edición
 
Matlab fair-record-model
Matlab fair-record-modelMatlab fair-record-model
Matlab fair-record-model
 
Dsp iit workshop
Dsp iit workshopDsp iit workshop
Dsp iit workshop
 
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
Машинное обучение на JS. С чего начать и куда идти | Odessa Frontend Meetup #12
 
NWD the73js.pptx
NWD the73js.pptxNWD the73js.pptx
NWD the73js.pptx
 
Ecg
EcgEcg
Ecg
 
SolutionsPlease see answer in bold letters.Note pi = 3.14.docx
SolutionsPlease see answer in bold letters.Note pi = 3.14.docxSolutionsPlease see answer in bold letters.Note pi = 3.14.docx
SolutionsPlease see answer in bold letters.Note pi = 3.14.docx
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 

More from COMSATS Abbottabad

Kalman filter
Kalman filterKalman filter
Kalman filter
COMSATS Abbottabad
 
Enterpreneurship
EnterpreneurshipEnterpreneurship
Enterpreneurship
COMSATS Abbottabad
 
Sine wave inverter
Sine wave inverterSine wave inverter
Sine wave inverter
COMSATS Abbottabad
 
Light Tracking Solar Panel
Light Tracking Solar PanelLight Tracking Solar Panel
Light Tracking Solar Panel
COMSATS Abbottabad
 
Analysis of Electro-Mechanical System
Analysis of Electro-Mechanical SystemAnalysis of Electro-Mechanical System
Analysis of Electro-Mechanical System
COMSATS Abbottabad
 
coding and burning program in FPGA
coding and burning program in FPGAcoding and burning program in FPGA
coding and burning program in FPGA
COMSATS Abbottabad
 
8 bit full adder
8 bit full adder8 bit full adder
8 bit full adder
COMSATS Abbottabad
 
Fabrication process of Integrated Circuit (IC's)
Fabrication process of Integrated Circuit (IC's)Fabrication process of Integrated Circuit (IC's)
Fabrication process of Integrated Circuit (IC's)
COMSATS Abbottabad
 
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
COMSATS Abbottabad
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086
COMSATS Abbottabad
 
Addition, subtraction and multiplication in assembly language
Addition, subtraction and multiplication in assembly languageAddition, subtraction and multiplication in assembly language
Addition, subtraction and multiplication in assembly language
COMSATS Abbottabad
 
Mathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in MatlabMathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in Matlab
COMSATS Abbottabad
 
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLABMathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
COMSATS Abbottabad
 
Introduction to MATLAB
Introduction to MATLAB Introduction to MATLAB
Introduction to MATLAB
COMSATS Abbottabad
 
Encoder + decoder
Encoder + decoderEncoder + decoder
Encoder + decoder
COMSATS Abbottabad
 
Principles of Communication
Principles of CommunicationPrinciples of Communication
Principles of Communication
COMSATS Abbottabad
 
Aurduino coding for transformer interfacing
Aurduino coding for transformer interfacingAurduino coding for transformer interfacing
Aurduino coding for transformer interfacing
COMSATS Abbottabad
 
Transformer Interfacing with Laptop
Transformer Interfacing with LaptopTransformer Interfacing with Laptop
Transformer Interfacing with Laptop
COMSATS Abbottabad
 
Temperature control Switch and Display By Led
Temperature control Switch and Display By LedTemperature control Switch and Display By Led
Temperature control Switch and Display By Led
COMSATS Abbottabad
 
stress and strain
stress and strainstress and strain
stress and strain
COMSATS Abbottabad
 

More from COMSATS Abbottabad (20)

Kalman filter
Kalman filterKalman filter
Kalman filter
 
Enterpreneurship
EnterpreneurshipEnterpreneurship
Enterpreneurship
 
Sine wave inverter
Sine wave inverterSine wave inverter
Sine wave inverter
 
Light Tracking Solar Panel
Light Tracking Solar PanelLight Tracking Solar Panel
Light Tracking Solar Panel
 
Analysis of Electro-Mechanical System
Analysis of Electro-Mechanical SystemAnalysis of Electro-Mechanical System
Analysis of Electro-Mechanical System
 
coding and burning program in FPGA
coding and burning program in FPGAcoding and burning program in FPGA
coding and burning program in FPGA
 
8 bit full adder
8 bit full adder8 bit full adder
8 bit full adder
 
Fabrication process of Integrated Circuit (IC's)
Fabrication process of Integrated Circuit (IC's)Fabrication process of Integrated Circuit (IC's)
Fabrication process of Integrated Circuit (IC's)
 
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086
 
Addition, subtraction and multiplication in assembly language
Addition, subtraction and multiplication in assembly languageAddition, subtraction and multiplication in assembly language
Addition, subtraction and multiplication in assembly language
 
Mathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in MatlabMathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in Matlab
 
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLABMathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
 
Introduction to MATLAB
Introduction to MATLAB Introduction to MATLAB
Introduction to MATLAB
 
Encoder + decoder
Encoder + decoderEncoder + decoder
Encoder + decoder
 
Principles of Communication
Principles of CommunicationPrinciples of Communication
Principles of Communication
 
Aurduino coding for transformer interfacing
Aurduino coding for transformer interfacingAurduino coding for transformer interfacing
Aurduino coding for transformer interfacing
 
Transformer Interfacing with Laptop
Transformer Interfacing with LaptopTransformer Interfacing with Laptop
Transformer Interfacing with Laptop
 
Temperature control Switch and Display By Led
Temperature control Switch and Display By LedTemperature control Switch and Display By Led
Temperature control Switch and Display By Led
 
stress and strain
stress and strainstress and strain
stress and strain
 

Recently uploaded

UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICSUNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
vmspraneeth
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
ijseajournal
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
um7474492
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
uqyfuc
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
harshapolam10
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
Paris Salesforce Developer Group
 
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENTNATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
Addu25809
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
MadhavJungKarki
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt
abdatawakjira
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
q30122000
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
ijaia
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
PriyankaKilaniya
 
Zener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and ApplicationsZener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and Applications
Shiny Christobel
 
5G Radio Network Througput Problem Analysis HCIA.pdf
5G Radio Network Througput Problem Analysis HCIA.pdf5G Radio Network Througput Problem Analysis HCIA.pdf
5G Radio Network Througput Problem Analysis HCIA.pdf
AlvianRamadhani5
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
upoux
 
Mechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineeringMechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineering
sachin chaurasia
 
Supermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdfSupermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdf
Kamal Acharya
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
AI-Based Home Security System : Home security
AI-Based Home Security System : Home securityAI-Based Home Security System : Home security
AI-Based Home Security System : Home security
AIRCC Publishing Corporation
 

Recently uploaded (20)

UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICSUNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
 
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENTNATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
 
Zener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and ApplicationsZener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and Applications
 
5G Radio Network Througput Problem Analysis HCIA.pdf
5G Radio Network Througput Problem Analysis HCIA.pdf5G Radio Network Througput Problem Analysis HCIA.pdf
5G Radio Network Througput Problem Analysis HCIA.pdf
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
 
Mechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineeringMechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineering
 
Supermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdfSupermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdf
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
AI-Based Home Security System : Home security
AI-Based Home Security System : Home securityAI-Based Home Security System : Home security
AI-Based Home Security System : Home security
 

Sampling

  • 1. Lab Task 2 Syed Abuzar DSP 1 Lab Report: Submitted By : Syed Abuzar Hussain Shah Reg # SP15-BEE-096 Submitted To: Sir Usman Class: BEE-5A Dated: 30/03/2017
  • 2. Lab Task 2 Syed Abuzar DSP 2 Introduction: In today’s Lab we will take a continuous time signal and sample it out with a fixed sampling time period and analyze its frequency response at each point. Commands to be used: • plot • real • exp • imag • Abs • phase • diff • sin/cos • hold on/off Task: Take a continuous time sinusoidal with a cut off frequency of 50 Hz with a simulated sampling frequency of 1000. Analyse its frequency spectrum using “fft”. clc clear all close all fn=50; fs=1000; N=1200; t=(-100:100)*1/fs; x=sin(2*pi*fn*t); subplot(241) plot(t*1000,x) title(['fn = ' num2str(fn) 'Hz fs = ' num2str(fs) 'Hz']) ylabel('x(t)') xlabel('ms') axis([-30 30 -2 2]) grid on;
  • 3. Lab Task 2 Syed Abuzar DSP 3 fsq=2*fn; x1=square(2*pi*fsq*t); subplot(242) plot(t*1000,x1) axis([-30 30 -2 2]) title(['fsq = ' num2str(fsq) 'Hz']) ylabel('x1(t)') xlabel('ms') grid on; imp=abs(diff(x1))/2; subplot(243) stem(t*1000,[imp 0]) title(['impulse']) ylabel(' delta(t)') xlabel('ms') axis([-30 30 -1 3]) grid on; k=1; for i=1:length(imp) if(imp(i)==1) y(i)=imp(i)*x(i); z(k)=y(i); k=k+1; end end subplot(244) stem(t*1000,[y 0]) hold on; plot(t*1000,x,'r'); title(['Sampled Data']) ylabel(' y(t)=x(t).delta(t)') xlabel('ms') axis([-30 30 -2 2]) grid on; om=linspace(-fs/2,fs/2,N);
  • 4. Lab Task 2 Syed Abuzar DSP 4 h=fft(x,N); z=fftshift(h); subplot(245) plot(om,abs(z)) title(['fft of sinosidal wave']) ylabel(' |X(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(x1,N); z=fftshift(h); subplot(246) plot(om,abs(z)) title(['fft of square wave']) ylabel(' |X1(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(imp,N); z=fftshift(h); subplot(247) plot(om,abs(z)) title(['fft of impulse']) ylabel(' |S(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(y,N); z=fftshift(h); subplot(248) plot(om/(2*fsq*pi),abs(z)) title(['fft of Y(jOmega)']) ylabel(' Y(jOmega)=X(jOmega)*S(jOmega)') xlabel('Omega(rad/sec)') grid on;
  • 5. Lab Task 2 Syed Abuzar DSP 5 Output: Now generate a square wave with frequency “3fn/2” and repeat all steps. clc clear all close all fn=50; fs=1000; N=1200; t=(-100:100)*1/fs; x=sin(2*pi*fn*t); subplot(241) plot(t*1000,x) title(['fn = ' num2str(fn) 'Hz fs = ' num2str(fs) 'Hz']) ylabel('x(t)') xlabel('ms') axis([-30 30 -2 2]) grid on; fsq=(3*fn)/2; x1=square(2*pi*fsq*t); subplot(242)
  • 6. Lab Task 2 Syed Abuzar DSP 6 plot(t*1000,x1) axis([-30 30 -2 2]) title(['fsq = ' num2str(fsq) 'Hz']) ylabel('x1(t)') xlabel('ms') grid on; imp=abs(diff(x1))/2; subplot(243) stem(t*1000,[imp 0]) title(['impulse']) ylabel(' delta(t)') xlabel('ms') axis([-30 30 -1 3]) grid on; k=1; for i=1:length(imp) if(imp(i)==1) y(i)=imp(i)*x(i); z(k)=y(i); k=k+1; end end subplot(244) stem(t*1000,[y 0]) hold on; plot(t*1000,x,'r'); title(['Sampled Data']) ylabel(' y(t)=x(t).delta(t)') xlabel('ms') axis([-30 30 -2 2]) grid on; om=linspace(-fs/2,fs/2,N); h=fft(x,N); z=fftshift(h); subplot(245) plot(om,abs(z))
  • 7. Lab Task 2 Syed Abuzar DSP 7 title(['fft of sinosidal wave']) ylabel(' |X(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(x1,N); z=fftshift(h); subplot(246) plot(om,abs(z)) title(['fft of square wave']) ylabel(' |X1(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(imp,N); z=fftshift(h); subplot(247) plot(om,abs(z)) title(['fft of impulse']) ylabel(' |S(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(y,N); z=fftshift(h); subplot(248) plot(om/(2*fsq*pi),abs(z)) title(['fft of Y(jOmega)']) ylabel(' Y(jOmega)=X(jOmega)*S(jOmega)') xlabel('Omega(rad/sec)') grid on;
  • 8. Lab Task 2 Syed Abuzar DSP 8 Output: Now generate a square wave with frequency “5fn” and repeat all steps. clc clear all close all fn=50; fs=1000; N=1200; t=(-100:100)*1/fs; x=sin(2*pi*fn*t); subplot(241) plot(t*1000,x) title(['fn = ' num2str(fn) 'Hz fs = ' num2str(fs) 'Hz']) ylabel('x(t)') xlabel('ms') axis([-30 30 -2 2]) grid on; fsq=5*fn; x1=square(2*pi*fsq*t);
  • 9. Lab Task 2 Syed Abuzar DSP 9 subplot(242) plot(t*1000,x1) axis([-30 30 -2 2]) title(['fsq = ' num2str(fsq) 'Hz']) ylabel('x1(t)') xlabel('ms') grid on; imp=abs(diff(x1))/2; subplot(243) stem(t*1000,[imp 0]) title(['impulse']) ylabel(' delta(t)') xlabel('ms') axis([-30 30 -1 3]) grid on; k=1; for i=1:length(imp) if(imp(i)==1) y(i)=imp(i)*x(i); z(k)=y(i); k=k+1; end end subplot(244) stem(t*1000,[y 0]) hold on; plot(t*1000,x,'r'); title(['Sampled Data']) ylabel(' y(t)=x(t).delta(t)') xlabel('ms') axis([-30 30 -2 2]) grid on; om=linspace(-fs/2,fs/2,N); h=fft(x,N); z=fftshift(h); subplot(245)
  • 10. Lab Task 2 Syed Abuzar DSP 10 plot(om,abs(z)) title(['fft of sinosidal wave']) ylabel(' |X(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(x1,N); z=fftshift(h); subplot(246) plot(om,abs(z)) title(['fft of square wave']) ylabel(' |X1(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(imp,N); z=fftshift(h); subplot(247) plot(om,abs(z)) title(['fft of impulse']) ylabel(' |S(jOmega)|') xlabel('Omega(rad/sec)') grid on; h=fft(y,N); z=fftshift(h); subplot(248) plot(om/(2*fsq*pi),abs(z)) title(['fft of Y(jOmega)']) ylabel(' Y(jOmega)=X(jOmega)*S(jOmega)') xlabel('Omega(rad/sec)') grid on;
  • 11. Lab Task 2 Syed Abuzar DSP 11 Output: Questions: Q1. Provide your analysis for the changed frequency of Impulse train. Ans: When we change the frequency of the square wave, the frequency of impulse train also changes. When frequency of impulse train increases, number of samples taken also increases so more information is stored. Q2: Explain if you observe under or over sampling . Ans: When I took samples according to Niquous Criteria (fsq=2fn), I observed over sampling (fsq=5fn) but when I taken fsq=1.5fn I observed under sampling.In Over sampling no data is lost but in under sampling we lose information. Conclusion: In this lab I learnt the difference between the oversampling and undersampling. The frequency of impulse train has main role in under and over sampling. If frequency is increased, sampling time also increases so we have more information about the signal.