Exercises in Matlab/Simulink VI

Similar documents
Time series analysis Matlab tutorial. Joachim Gross

Transition Bandwidth Analysis of Infinite Impulse Response Filters

Design of Efficient Digital Interpolation Filters for Integer Upsampling. Daniel B. Turek

Analog Filters. A common instrumentation filter application is the attenuation of high frequencies to avoid frequency aliasing in the sampled data.

NAPIER University School of Engineering. Electronic Systems Module : SE32102 Analogue Filters Design And Simulation. 4 th order Butterworth response

First, we show how to use known design specifications to determine filter order and 3dB cut-off

Digital Signal Processing Complete Bandpass Filter Design Example

ELEN E4810: Digital Signal Processing Topic 8: Filter Design: IIR

2.161 Signal Processing: Continuous and Discrete Fall 2008

Digital Signal Processing IIR Filter Design via Impulse Invariance

Em bedded DSP : I ntroduction to Digital Filters

How to Design 10 khz filter. (Using Butterworth filter design) Application notes. By Vadim Kim

UNIVERSITY OF CALIFORNIA, SAN DIEGO Electrical & Computer Engineering Department ECE Fall 2010 Linear Systems Fundamentals

Laboratory #5: RF Filter Design

Filter Comparison. Match #1: Analog vs. Digital Filters

chapter Introduction to Digital Signal Processing and Digital Filtering 1.1 Introduction 1.2 Historical Perspective

Sophomore Physics Laboratory (PH005/105)

EE 402 RECITATION #13 REPORT

SUMMARY. Additional Digital/Software filters are included in Chart and filter the data after it has been sampled and recorded by the PowerLab.

SECTION 6 DIGITAL FILTERS

Frequency response. Chapter Introduction

Lecture 9. Poles, Zeros & Filters (Lathi 4.10) Effects of Poles & Zeros on Frequency Response (1) Effects of Poles & Zeros on Frequency Response (3)

Lab 1. The Fourier Transform

SGN-1158 Introduction to Signal Processing Test. Solutions

FAST Fourier Transform (FFT) and Digital Filtering Using LabVIEW

EE289 Lab Fall LAB 4. Ambient Noise Reduction. 1 Introduction. 2 Simulation in Matlab Simulink

What you will do. Build a 3-band equalizer. Connect to a music source (mp3 player) Low pass filter High pass filter Band pass filter

CHAPTER 6 Frequency Response, Bode Plots, and Resonance

Digital filter design for electrophysiological data a practical approach

Lock - in Amplifier and Applications

24 Butterworth Filters

A Basic Introduction to Filters Active Passive and Switched-Capacitor

The Calculation of G rms

LM833,LMF100,MF10. Application Note 779 A Basic Introduction to Filters - Active, Passive,and. Switched Capacitor. Literature Number: SNOA224A

Infinite Impulse Response Filter Structures in Xilinx FPGAs

Frequency Response of FIR Filters

Frequency Response of Filters

Lecture 1-6: Noise and Filters

B3. Short Time Fourier Transform (STFT)

Introduction to IQ-demodulation of RF-data

Filter Design and Implementation

Short-time FFT, Multi-taper analysis & Filtering in SPM12

CHAPTER 8 ANALOG FILTERS

Design of FIR Filters

Impedance 50 (75 connectors via adapters)

Understanding CIC Compensation Filters

Analog signals are those which are naturally occurring. Any analog signal can be converted to a digital signal.

Chebyshev Filter at MHz Frequency for Radar System

AN-837 APPLICATION NOTE

IIR Half-band Filter Design with TMS320VC33 DSP

Analog and Digital Filters Anthony Garvert November 13, 2015

Engineering Sciences 22 Systems Summer 2004

1995 Mixed-Signal Products SLAA013

Engineering Data Management Software Specifications

Controller Design in Frequency Domain

Introduction to Digital Filters

ELECTRONIC FILTER DESIGN HANDBOOK

Anatech Electronics, Inc.

ANALYZER BASICS WHAT IS AN FFT SPECTRUM ANALYZER? 2-1

An Introduction to Using Simulink

A DESIGN OF DSPIC BASED SIGNAL MONITORING AND PROCESSING SYSTEM

Laboratory 4: Feedback and Compensation

Chapter 4: Passive Analog Signal Processing

ECE 3510 Final given: Spring 11

Implementation of the LMS Algorithm for Noise Cancellation on Speech Using the ARM LPC2378 Processor.

MATLAB Control System Toolbox Root Locus Design GUI

PIEZO FILTERS INTRODUCTION

Selected Filter Circuits Dr. Lynn Fuller

CIRCUITS LABORATORY EXPERIMENT 3. AC Circuit Analysis

for Communication Systems Protection EMI CD-ROM INCLUDED

PLL frequency synthesizer

DSP-I DSP-I DSP-I DSP-I

Harmonics and Noise in Photovoltaic (PV) Inverter and the Mitigation Strategies

SWISS ARMY KNIFE INDICATOR John F. Ehlers

The Z transform (3) 1

LAB 12: ACTIVE FILTERS

Department of Electrical and Computer Engineering Ben-Gurion University of the Negev. LAB 1 - Introduction to USRP

Building a Simulink model for real-time analysis V Copyright g.tec medical engineering GmbH

TTT4110 Information and Signal Theory Solution to exam

ADC and DAC. Quantization

Clutter Filter Design for Ultrasound Color Flow Imaging

Motorola Digital Signal Processors

Designing a Linear FIR filter

Active Vibration Isolation of an Unbalanced Machine Spindle

Audio Signal Processing Studio Remote Lab for Signals and Systems Class

Time-series filtering techniques in Stata

Analog IIR Filter Design

isim ACTIVE FILTER DESIGNER NEW, VERY CAPABLE, MULTI-STAGE ACTIVE FILTER DESIGN TOOL

Chapter 16. Active Filter Design Techniques. Excerpted from Op Amps for Everyone. Literature Number SLOA088. Literature Number: SLOD006A

Implementation of Digital Signal Processing: Some Background on GFSK Modulation

Use bandpass filters to discriminate against wide ranges of frequencies outside the passband.

The continuous and discrete Fourier transforms

CTCSS REJECT HIGH PASS FILTERS IN FM RADIO COMMUNICATIONS AN EVALUATION. Virgil Leenerts WØINK 8 June 2008

MATRIX TECHNICAL NOTES

Lab #9: AC Steady State Analysis

UNIVERSITY OF CALIFORNIA AT BERKELEY College of Engineering Department of Electrical Engineering and Computer Sciences. EE105 Lab Experiments

System Modeling and Control for Mechanical Engineers

Michael Hiebel. Fundamentals of Vector Network Analysis

SAMPLE SOLUTIONS DIGITAL SIGNAL PROCESSING: Signals, Systems, and Filters Andreas Antoniou

Transcription:

081212/ Thomas Munther Halmstad University School of Information Technology, Computer Science and Electrical Engineering Exercises in Matlab/Simulink VI In this exercise will we use another tool within Matlab called fdatool. Simply write fdatool in the command window. >> fdatool This tool allows one to construct filters of different types: Lowpass, HighPass, Bandpass and Bandstop together with different designs like Butterworth, ChebyshevI, Chebyshev II and Elliptic filters (IIR) or FIR filters using window methods among other techniques. We can of course specify very high orders or choose from 16 different windows. The frequency specification need sampling frequency and frequencies for passband and stopband. These need to be written either as frequency[hz] or as normalized between 0 and 1. In the menu one can find other useful things like: impulse responses, step responses, pole/zero map, filter coefficients, magnitude and phase characteristics. This tool also provides possibilty to import filters or export a variable to the command window/ or as a block to Simulink or even generate a m-file. Figure 1 1

Design a filter of LowPass (Butterworth ) since fdatool only designs discrete filters it is also a IIR filter as well. Choose sampling frequency 48000 Hz, cutoff frequency for passband is 9600 Hz and the stopband starts from 12000 Hz. Attenuation in the passband 1dB and attenuation in the stopband 20 db. Also choose minimum order. Now press the button Design filter and the corresponding magnitude function is plotted. On the left side if the plot window are some information about the filter. For instance 10:th order and stable filter. Now let ut export our filter to Simulink. Enter File-> Export to Simulink Model See figure 2! Figure 2 Give the Block used in the Simulink environment a name: Filter_LP Press the button Realize Model at the bottom.. Simulink starts and a mdl-file is opened with our filter there, figure 3. 2

Figure 3 Let us now apply some signals to the filter to see how it performs. If you are curious you can also double-click on the Filter icon to see how its Block diagram looks like, figure 4. Figure 4 3

Sampling time is 1/48000 sec. Choose the angular frequencies to be: 1000*2π and 12000*2π in Sine wave blocks and add these together with a constant 1. Let then this signal enter the filter and see the filter action. Figure 5 Figure 6 4

Filter using pole-zero map We will try to design a filter using a technique where we pick poles and zeros that reinforces or attenuates different frequencies. This can be done by finding the corresponding poles for the signals suppose we have the same signal as in figure 4. >> t =0: 1/48000:1; % sampling frequency 48000 Hz. >> x = 1.+ sin(2*pi.*1000*t).+ sin(2*pi*12000.*t); >> plot(t,x) % The unfiltered input signal, figure 7 Figure 7 Eliminate the high frequency component by choosing a transfer function containing zeros at locations +i and i. 0.5 (z^2 + 1) H[z]= --------------, to make the filter add two poles at origin. z^2 There is also a constant 0.5 assuring that the DC-gain goes to 1. >> H=zpk([ i i],[ 0 0 ],0.5, 1); >> y=filter([1 0 1],[1 0 0],x ) % numerator and denominator polynomials of H. % are the two first arguments and x the signal % needed to be filtered. >> plot(t,y) % See the filtered output, figure 8! 5

Figure 8 IIR Filters using bilinear method ---------------------------------------------------------------------------------------------------------- To design a digital filter by the Butterworth and Chebyshev analog prototypes in matlab. First step is to decide the analog filter that meets the desired criteria and then map the analog filter to a discrete filter by a bilinear transformation. Start from a LowPass N- pole filter with a cutoff frequency 1 rad/sec. Then transform the filter via frequency transformations like : lp2lp, lp2bp, lp2hp or lp2bs to the final analog filter. From there we map the transfer function to a digital transfer function by the command bilinear. Example: Investigate a two-pole Butterworth filter, cutoff frequency 2 rad/sec and sampling period,t=0.2. [z,p,k]=buttap(2); % creates a 2-pole Butterworth filter, wc=1rad/sec [num,den] = zp2tf(z,p,k) % gives the transfer function polynomials wc=2 % desired cutoff frequency [num,den] = lp2lp(num,den,wc) % frequency transformation T=0.2; [numd,dend] = bilinear(num,den,1/t) H=tf(numd,dend,1) % corresponding digital transfer function Now let us see how the Bode plots for the analog filter and digital filter look like. >> bode(h), hold, bode(num,den) 6

0 Bode Diagram -50-100 Magnitude (db) -150-200 -250-300 -350-400 0-90 Phase (deg) -180-270 -360 10-2 10-1 10 0 10 1 10 2 Frequency (rad/sec) Figure 9 For low frequencies the magnitude functions seem to overlap, but at higher frequencies the gap between them becomes wider. 7

Exercises to be solved The exercises should be handed in as m-files or mdl-files and sent to my emailadress. These exercises can be handed in individually or as a group, but notice that the group must not be larger than 2. Can give bonus points on the written exam. 1. Improve the filter in figure 4. see if you can make the 1000 Hz signal cleaner in the output. Also combine this LP-filter with some other IIR-filter to eliminate the DC-voltage in the output. The filters should be cascaded! 2. Use a different approach to improve the filter in figure 4. Design a filter that attenuates DC-frequency and frequency 12000 Hz and possibly magnifies the frequency 1000 Hz. By using a method with poles and zeros, where we choose a certain pole close to the unit circle in the transfer function to reinforce a frequency and zeros (close to the unit circle) attenuates frequencies. Hint: use zpk and at least filter order 3. 3. Use the fdatool to filter x(t) in problem 3, so that 12000 Hz sine wave is eliminated and the bias voltage disappears. Use a FIR filter with method windows. Try both Rectangular and Gaussian windows use the same cutoff frequencies and same order Combine two cascaded FIR-filters to solve the assignment. 4. Design a causal filter that eliminates 50 Hz sine wave signals while the alternating sequence (-1) n u[n] is reinforced with a factor 10. The frequency of the sampling is 200 Hz. Show the corresponding Bode plot of the filter. And give the corresponding transfer function. Hint: third order filter is enough! 5. Download the mat-file handel_dist.mat. It contains a vector Y and a scalar Fs. Play it with the command sound(y,fs). You can hear the Mass of Händel known as Messiah. It is contaminated with a square wave signal with frequency 1000Hz. According to the theory of Fourier Series any periodic signal could be described to consist of the fundamental frequency and multiples of the fundamental frequency. To get rid of the noise it is probably a very bad idea to use a conventional Low Pass or High Pass filter due to the frequency content of the music. Better is to try the Comb filter. See lecture notes! The Combfilter attenuates the fundamental frequency and all its multiples. How should the true music sound? Just download the file with: >> load handel >> sound(y,fs) Give it your best shot! The resulting music should be played as well as the corresponding filter should be shown. 8