Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please complete part 2.2 and 2.4 2.2 Generating Sinusoids and Decaying Sinusoids An example for generating a sinusoid was included in Lab#0 Here, we will

Please complete part 2.2 and 2.4
image text in transcribed
image text in transcribed
2.2 Generating Sinusoids and Decaying Sinusoids An example for generating a sinusoid was included in Lab#0 Here, we will again use the built-in MATLAB editor to create a script file called mySinusoid.ncontaining the following lines for future use: function xySinusoid(amp, freq, pha, fs, tsta, tend) amp- amplitude % freq . frequency in cycle per second % pha- phase, time offset for the first peak fs-number of sample values per second tata-starting time in sec % tend -ending time in sec tt = tsta : 1/fs : tend ; % time indices for all the values xs -anp cos freq 2.pi tt pha end This function nySinusoid can be called once the argument values are specified. For example, re 80; pha pi/6; fs8000; tend 3; a 3-sec long signal xs-nySinusoid(aap. freq, pha, fs, tsta, tend); plot first three cycles of the generated sinusoid ts tsta: 1/fs: tsta+3/freq: Lt length( ts) ; plot ts, xs(1:Lt),' ts, 2*xs(1Lt)'r grid on title('TEST PLOT of TWO SINUSOIDS (aling by 2)') xlabel( TIME (sec)') You may want to try other numbers to appreciate the use of the function. In lecture, the three parameters of a sinusoid have been studied, along with many properties of sinusoids. Here we are most interested in the plotting tool which has many options (so you may want to read its documentation carefully). Now, extend the previous example to make a decaying sinusoid, e.. Write a function called nyDecayingSinusoid(A, b, onega, phi, fs, tStart, tEnd) Then pick the correct numbers to generate and plot a decaying sinusoid xDecay that is 2 seconds long. with a frequency of 40 Hz, an amplitude of 10, a phase of /4 rads, and a decay parameter b = 08 What happens to the plot if we increase the decaying rate to b = 3-Show the plotting result to the lab instructor. Instructor Verification (separate page) 2.2 Generating Sinusoids and Decaying Sinusoids An example for generating a sinusoid was included in Lab#0 Here, we will again use the built-in MATLAB editor to create a script file called mySinusoid.ncontaining the following lines for future use: function xySinusoid(amp, freq, pha, fs, tsta, tend) amp- amplitude % freq . frequency in cycle per second % pha- phase, time offset for the first peak fs-number of sample values per second tata-starting time in sec % tend -ending time in sec tt = tsta : 1/fs : tend ; % time indices for all the values xs -anp cos freq 2.pi tt pha end This function nySinusoid can be called once the argument values are specified. For example, re 80; pha pi/6; fs8000; tend 3; a 3-sec long signal xs-nySinusoid(aap. freq, pha, fs, tsta, tend); plot first three cycles of the generated sinusoid ts tsta: 1/fs: tsta+3/freq: Lt length( ts) ; plot ts, xs(1:Lt),' ts, 2*xs(1Lt)'r grid on title('TEST PLOT of TWO SINUSOIDS (aling by 2)') xlabel( TIME (sec)') You may want to try other numbers to appreciate the use of the function. In lecture, the three parameters of a sinusoid have been studied, along with many properties of sinusoids. Here we are most interested in the plotting tool which has many options (so you may want to read its documentation carefully). Now, extend the previous example to make a decaying sinusoid, e.. Write a function called nyDecayingSinusoid(A, b, onega, phi, fs, tStart, tEnd) Then pick the correct numbers to generate and plot a decaying sinusoid xDecay that is 2 seconds long. with a frequency of 40 Hz, an amplitude of 10, a phase of /4 rads, and a decay parameter b = 08 What happens to the plot if we increase the decaying rate to b = 3-Show the plotting result to the lab instructor. Instructor Verification (separate page)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions