Fundamental of Signals 2-1 Fundamentals of Signals Practical Signal Processing Concepts and...
-
Upload
julius-hill -
Category
Documents
-
view
241 -
download
0
Transcript of Fundamental of Signals 2-1 Fundamentals of Signals Practical Signal Processing Concepts and...
Fundamental of Signals
2-1
Fundamentals of Signals
Practical Signal Processing Concepts and Algorithms using MATLAB
__________________________________________________________________________________________________________
QMS Management Consultants Sdn Bhd (401766-U)
98-1-31 Prima Tanjung Jalan Fettes Tanjung Tokong 11200 Pulau Pinang Malaysia
Telephone +604 899 6020 Facsimile +604 899 4020 E-mail [email protected]
11203 FM 2222 #801 Austin Texas 78730
Fundamental of Signals
2-2
What is signal Processing?What is signal Processing?
• The scope of signal processing has grown so broad as to obviate a perfect and precise definition of what is entailed in it
• Traditionally, signal processing includes the materials thought in DSP courses but now signal processing has greater reach because of its influence on related disciplines such as controls, communications theory and also digital communication.
• Thus, signal processing can be defined as that area of applied mathematics that deals with operations on or analysis of signals, in either discrete or continuous time, to perform useful operations on those signals.
Fundamental of Signals
2-3
Digital signal processing is the process of extracting useful information from an incoming set of signal (sampled at regular interval, Ts)
When you speak, your voice is picked up by an analog sensor in the cell phone’s microphone
An analog-to-digital converter chip converts your voice (analog) into digital signals, representing 1s and 0s
The Digital Signal Processor (DSP) compresses the digital signals and remove any noise.
In the receiver’s cell phone, a digital-to-analog converter chip changes the digital signal back to an analog voice signal
Your voice exits the phone through the speaker
Fundamental of Signals
2-4
What is Signal Processing Toolbox?What is Signal Processing Toolbox?
• The Signal Processing Toolbox is a collection of tools built on the MATLAB® numeric computing environment.
• The toolbox supports a wide range of signal processing operations, from waveform generation to filter design and implementation, parametric modeling, and spectral analysis.
• The toolbox provides two categories of tools.
Fundamental of Signals
2-5
Section Outline
• Creating and importing signals
• Sampling and re-sampling
• Signal visualization
• Modeling noise
• Modulation
Fundamental of Signals
2-6
Discrete Signals
Time base: t = [0.0 0.1 0.2 0.3];
Signal data: x = [1.0 3.2 2.0 8.5];
Creating vectors in MATLAB:
>> t = [0.0 0.1 0.2 0.3];
>> t = 0:0.1:0.3;
>> t = linspace(0, 0.3, 4);
Fundamental of Signals
2-7
Sampling Signals
Analog signal sources Electromagnetic, audio, sonar, biomedical
Sampling
)()( sa nTxnx
discrete signal
analog signal
sample time
Fundamental of Signals
2-8
Aliasing
Ms ff 2Shannon Sampling Theorem:
Ms ff 2 Ms ff 2
Original signal and sampled signal have same frequency
Sampled signal is aliased to half the original frequency
Fundamental of Signals
2-9
Signal Visualization
• View signal amplitude vs. time index
• Functions plot, stem, stairs, strips
• Listen to data sound
Fundamental of Signals
2-10
Signal Processing Tool
>> sptool
Fundamental of Signals
2-11
Importing a Signal
Choose Import under the File menu
Fundamental of Signals
2-12
• Since MATLAB is a programming language, an endless variety of different signals is possible. Here are some statements that generate several commonly used sequences, including the unit impulse, unit step, and unit ramp functions:
>> t = (0:0.01:1);
>> y = ones(101); % step
>> y = [1; zeros(100,1)]; % impulse
>> y = t ; % ramp
>> y = t.^2; % exponential
>> y = square(2*pi*4*t); % generates a square wave every 0.25secs.
Signal Processing BasicsCommon Sequences
Fundamental of Signals
2-13
Waveform generation
>> y = sin(2*pi*50*t) + 2*sin(2*pi*120*t); %two sinusoids, %one at 50 Hz %and one at %120Hz with %twice the amplitude
>> plot(t,y) %plot y versus time
>> plot(t(1:50),y(1:50)) %display only the first %50 points(zoom!)
Fundamental of Signals
2-14
Signal Browser
Fundamental of Signals
2-15
Changing Sample Rates
To change the sample rate of a signal in SPTool,
1. Click one signal in the signals column of SPTool.2. Select Sampling Frequency in the Edit menu.3. Enter the desired sampling frequency and click OK.
Fundamental of Signals
2-16
Signal GenerationSignal Generation
Signals
• Create a time base vector>> t = [0:0.1:2];
• Signal as function of time>> x = sin(pi*t/2);
Useful MATLAB Functions
• Nonperiodic functionsones, zeros, step
• Periodic functionssin, cos, square, sawtooth
Fundamental of Signals
2-17
Non-periodic Signals
>> t = linspace(0,1,11)
• Step
>> y = ones(11,1);
• Impulse
>> y = [1;zeros(10,1)];
• Ramp
>> y = 2*t;
Fundamental of Signals
2-18
Sine Waves
Parameters
• Amplitude A
• Frequency f
• Phase shift φ
• Vertical offset B
General form
BtfABftAy ))(2sin()2sin(
Fundamental of Signals
2-19
Square Waves
>> sqw1 = square(2*pi*4*t);
>> sqw2 = square(2*pi*4*t,75);
• Duty cycle is 50% (default)• Frequency is 4 Hz
• Duty cycle is 75% • Frequency is 4 Hz
Fundamental of Signals
2-20
Sawtooth Waves
>> saw1 = sawtooth(2*pi*3*t);
>> saw2 = sawtooth(2*pi*3*t,1/2);
• Peak at end of cycle (default)• Frequency is 3 Hz
• Peak halfway through cycle • Frequency is 3 Hz
Fundamental of Signals
2-21
Complex Signals
x(t) = e j2ft = cos(2 ft) + j sin(2 ft) = cos(ωt) + j sin(ωt)
>> x = exp(2*pi*j*f*t);
Useful MATLAB Functions: real, imag, abs, angle
z-plane: e jω Time domain: sin(ωt)
Fs/2 0,Fs
Fundamental of Signals
2-22
textread
xlsreadimread
importdata wavreaduiimport
input
Importing Data
Fundamental of Signals
2-23
Modeling Noise with Random Data
>> un = -5+10*rand(1,1e6);>> hist(un,100)
>> gn = 10+5*randn(1,1e6);>> hist(gn,100)
Uniform Gaussian
Fundamental of Signals
2-24
Adding Noise to a Signal
noisy signal = signal + noise
>> y1 = x + rand(size(x)) uniform noise
>> y2 = x + randn(size(x)) Gaussian noise
Fundamental of Signals
2-25
Pseudorandomness
0.95012928514718
This is the first number produced by the MATLAB uniform random number generator with its default settings. Is it random?
A random sequence is a vague notion ... in which each term is unpredictable to the uninitiated and whose digits pass a certain number of tests traditional with statisticians ...
- D.H. Lehmer
>> rand('state',s) Sets the state to s.
>> rand('state',0) Resets the generator to its initial state.
>> rand('state',sum(100*clock)) New state each time.
Fundamental of Signals
2-26
Resampling
Useful MATLAB functions
downsample, upsample, resample, interp, decimate
Fundamental of Signals
2-27
Modulation and Demodulation
y = modulate(x,fc,fs,'fm')
x = demod(y,fc,fs,'fm')