EE 453 Introduction to Simulink

Page ZOOM EE 453: Lab 1Introduction to Simulink: Audio Signal ProcessingSeptember 19 2018OverviewThe purpose of this first lab is to familiarize the student with DSP developmentusing MATLAB Simulink. You will learn how to use the Simulink equivalents ofhardware measurement tools such as oscilloscopes and spectrum analyzers. Youwill then do some basic audio signal processing tasks finishing by examiningsome common audio effects used in music.Each DSP workstation in the EE 453 lab is equipped with a computer withMATLAB Simulink installed and headphones to be used so you don’t disturbother students.The software used in the EE 453 lab isSimulink a component of MATLAB thatis a block diagram based development platform (similar to LabView). Simulinkallows for fast generation of DSP algorithms using an easy to learn drag-and-drop approach.1 1 System SetupBefore beginning the lab you must make sure the system is setup as follows:•Connect your headphones to the Headphone jack on the front of the com-puter•Log on to the computer using your PSU access account.You must saveall files on your PSU W: drive. Please do not store any fileson the computer itself. It takes up hardrive space and will bedeleted periodically. While not necessary to save the files they will begood to have as a reference for the future labs this semester.•Download the.zipfile from Canvas containing files needed to completethe lab.2 Simulink Bench InstrumentsAs a first experiment you will learn how to use Simulink’s spectrum analyzerand oscilloscope.1. Open up MATLAB and change the current directory to your PSU W:drive. Do this by selecting theBrowse for Foldericon located above theCURRENT FOLDER window. If you want you may create an EE 453subdirectory on your W: drive by selecting theNew Folderbutton in theselection window.2. Typesimulinkin the MATLAB command window. You will want to opena new blank model. Once this window is open notice the red white andblue squares in the toolbar. This is how you access theSimulink LibraryBrowser.3. Enlarge this window so that it covers about half of your screen but don’tcover up theSimulink Library Browserwindow. You will be dragging/-dropping blocks from various libraries into this model window to createyour various DSP algorithms. You are now ready to start building yourfirst model.2 4. The first thing is audio sources that will act as inputs to the model. IntheSimulink Libary BrowserselectDSP System toolbox→Sources→From Multimedia Fileand drag this into the model window5. After adding the block you must set its parameters. This can be doneby double clicking on the block. Do this for theFrom Multimedia Fileblock underFilenamebrowse until you find the audio file ”Track1.wav”downloaded from the canvas website. Accept the rest of the defaults.6. In to play the audio file you must add another block from the librarybrowser. The needed block isDSP System toolbox→Sinks→AudioDevice Writer. Again accept the defaults. Keep in mind the blocks mustbe connected together by clicking on the port on the block and draggingto the next block. Test the system so far by clicking the green play buttonat the top of the Simulink file.7. We are now ready to actually analyze some signals. The first thing weare going to do is create some pure sinusoids in MATLAB. A template isgiven below:%%S c r i p t t o c r e a t e a s i n u s o i d%%I n p u t sFs = 8 0 0 0 ;%S a m p l i n g Ratef r e q = 8 0 0 ;%D e s i r e d t o n e ( Hz )f n = ‘ 800Hz ‘ ;%F i l e n a m eA = 0 . 1 ;%M a g n i t u d e o f s i n u s o i dT = 3 ;%L e n g t h o f s i g n a l ( s )%%S o u n d f i l et = 0 : 1 / Fs : T ;y = A∗cos( 2∗pi∗f r e q∗t ) ;a u d i o w r i t e ( s t r c a t ( f n ‘ . wav ‘ ) y Fs ) ;Answer Q1 and Q2 on your worksheet8. Use the script above or your own version to create two discrete sinusoidswithωc= 0.2 andωc= 0.8. Use a sampling rate ofFs= 8000.9. In the Simulink window we are going to place a Spectrum Analyzer inparallel with the Audio output. As the name would imply a spectrum3 analyzer allows the user to view the frequency content (spectrum) of asignal. The spectrum analyzer is found inDSP System toolbox→Sinks→Spectrum Analyzer. The spectrum analyzer can be connectedin parallel by connecting the output port to the middle of the line betweenthe audio input and outputs.10. View the two sinusoids through the spectrum analyzer (run the simulinkfile). Verify that the peaks of the signals are at the expected frequencies.This can be done by using the file menus of the spectrum analyzerTools→Measurements→Peak Finder.Call your TA over to verify that this program is working.YourTA will sign your lab worksheet.11. Without changing the two continuous frequencies change the samplingrate in the sinusoid creation script toFs= 4000. Pass these modifiedsinusoids through the spectrum analyzer.Answer Q3 and Q4 on your worksheet12. You will now implement an echo effect and analyze how feedback canchange the stability of a system. In to view this phenomenon wewill be using the oscilloscope.13. Remove the spectrum analyzer from the current simulink file (or create anew one keeping the audio input and output (I/O).14. The oscilloscope can be found inDSP System toolbox→Sinks→Time Scope.15. Change the input audio signal toEchoSample.wav. This audio file issampled at the standard CD sampling rate of 44.1 kHz.16. In to implement an echo sample we are going to want to implementthe difference equationy[n] +Ay[n−δ] =x[n]. The difference equationrequires three blocks:•Summing Block:Simulink library→Math Operations→Sum•Gain Block:Simulink library→Math Operations→Gain•Delay Block:DSP System Toolbox→Signal Operations→Delay4 17. To implement the difference equation the sum block must be placed be-tween the input and output I/O. The wire connecting the sum to theoutput must then be fed into the delay block followed by the gain blockand back into the sum block. In may be helpful to rotate the blocks in to have them point in the correct direction. This can be done viaRight click + Ctrl + R.18. Double-click on the delay block and set the following parameters. Therest can be left as default.•Delay Length: 4410019. Double click on the Gain block and set the parameters. The rest can beleft as default.•Gain: 0.720. Run simulink and observe the output. Then modify the following param-eters:•Delay (samples): 10000•Gain: 1.1Answer Q5 and Q6 on your worksheetCall your TA over to verify that this program is working.Your TA willsign your lab worksheet.5 3 Audio Signal ProcessingThis audio signal processing portion will focus more on just using the noramlMATLAB functionality of scripts and functions.1. For this first part of the experiment you will implement a chirp signalusing MATLAB.A sinusoidal waveform can be described asx(t) =sin(φ(t)). The instanta-neous frequency is taken to be the derivative of the phasef(t) =12Ï€dφ(t)dt.A linear chirp is whenf(t) =f0+kt.2. A chirp signal is easily identified using a graph called a spectrogram. Aspectrogram gives a plot of frequency on the y-axis and time on the x-axis.3. The chirp you implement should be as follows:t = 0 : 1 / 1 e 3 : 2 . 7 ;y = c h i r p ( t 0 1 2 5 0 ) ;s p e c t r o g r a m ( y 2 5 6 2 5 0 2 5 6 1 e3 ‘ y a x i s ‘ ) ;Answer Q7 on your worksheet4. In this part of the lab you will create two sinusoids and find what happenswhen the two sinusoids are added together. Create two sinusoids and addthem together in the same script so they have the exact same phase i.e.y1(t) =sin(ω1t)y2(t) =sin(ω2t)y(t) =y1(t) +y2(t)5. SetFs= 1080f1= 510 andf2= 530.6. Listen to the output usingsoundsc(yFs)in MATLAB7. Now changeFs= 1040 and listen to the differenceAnswer Q8 and Q9 on your worksheetCall your TA over to verify that this program is working.YourTA will sign your lab worksheet.6 8. The final task for this lab will be analyzing the following wah phaser andflanger effects. Based on the following MATLAB code which implementsthe effects answer the questions on your worksheet.9. Here is a sample of the wah effect used in musicwahsample.wav. Thefollowing is the matlab code to implement this effect.l f of r e q = 1 ;l f om i n = 2 0 0 ;l f om a x = 2 0 0 0 ;l f o = s a w t o o t h ( 2∗p i∗l f of r e q∗( 1 : l e n g t h ( x ) ) / Fs 0 . 5 ) ;l f o = 0 . 5∗( l f om a x−l f om i n )∗l f o +( l f om i n+l f om a x ) / 2 ;de pth = 2 ;y = z e r o s ( 1 l e n g t h ( x ) ) ;f o r j =3: l e n g t h ( x )[ b a ] = i i r p e a k ( 2∗l f o ( j ) / Fs 2∗l f o ( j ) / Fs / de pt h ) ;y ( j ) = b ( 1 )∗x ( j )+b ( 2 )∗x ( j−1)+b ( 3 )∗x ( j−2) . . .−a ( 2 )∗y ( j−1)−a ( 3 )∗y ( j−2 ) ;end10. Here is a sample of the phaser effect used in musicphasesample.wav. Thefollowing is the matlab code to implement this effect (2 stage phaser).l f of r e q = 1 ;l f om i n = 2 0 0 ;l f om a x = 2 0 0 0 ;l f o = s a w t o o t h ( 2∗p i∗l f of r e q∗( 1 : l e n g t h ( x ) ) / Fs 0 . 5 ) ;l f o = 0 . 5∗( l f om a x−l f om i n )∗l f o +( l f om i n+l f om a x ) / 2 ;y = z e r o s ( 1 l e n g t h ( x ) ) ;f o r j =3: l e n g t h ( x ) ;[ b a ] = i i r n o t c h ( 2∗l f o ( j ) / Fs 2∗l f o ( j ) / Fs ) ;y ( j ) = b ( 1 )∗x ( j )+b ( 2 )∗x ( j−1)+b ( 3 )∗x ( j−2) . . .−a ( 2 )∗y ( j−1)−a ( 3 )∗y ( j−2 ) ;endx = y ;y = z e r o s ( 1 l e n g t h ( x ) ) ;f o r j =3: l e n g t h ( x ) ;[ b a ] = i i r n o t c h ( 6∗l f o ( j ) / Fs 6∗l f o ( j ) / Fs ) ;y ( j ) = b ( 1 )∗x ( j )+b ( 2 )∗x ( j−1)+b ( 3 )∗x ( j−2) . . .−a ( 2 )∗y ( j−1)−a ( 3 )∗y ( j−2 ) ;end11. Here is a sample of the flanger effect used in musicflangesample.wavl f of r e q = 1 / 3 ;l f oa m p = 0 . 0 0 4 ;7 l f o = 2+s a w t o o t h ( 2∗p i∗l f of r e q∗( 1 : l e n g t h ( x ) ) / Fs 0 . 5 ) ;i n d e x = round ( ( 1 : l e n g t h ( x ))−Fs∗l f oa m p∗l f o ) ;i n d e x ( i n d e x<1) = 1 ;i n d e x ( i n d e x>l e n g t h ( x ) ) = l e n g t h ( x ) ;y=x ;f o r j =1: l e n g t h ( x )y ( j ) = y ( j )+x ( i n d e x ( j ) ) ;endAnswer Q10 Q11 and Q12 on your worksheet8 Requirements: as long as need

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 30% with the discount code HAPPY