Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB. Please complete questions 2.2, 2.3, and 2.4 2.2 Generating Sinusoids and Decaying Sinusoids An example for generating a sinusoid was included in Lab#0 Here,

MATLAB. Please complete questions 2.2, 2.3, 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, tise 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, freq 80; pha pi/6; fs8000; tsta 0; tend 3; a 3-sec long signal xs-mySinusoid(p, freq, pha, fs, tsta, tend); %( plot first three cycles of the generated sinusoid ts tsta: 1/fs: tsta+3/freq: Ltlength( ts) ; plot ts, xs(1:Lt),' ts, 2*xs(1Lt)'r grid on title('TEST PLOT of TWO SINUSOIDS (scaling 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, i.e. r(t)-Ae-bt cos(wt + ) 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 0.8 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, tise 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, freq 80; pha pi/6; fs8000; tsta 0; tend 3; a 3-sec long signal xs-mySinusoid(p, freq, pha, fs, tsta, tend); %( plot first three cycles of the generated sinusoid ts tsta: 1/fs: tsta+3/freq: Ltlength( ts) ; plot ts, xs(1:Lt),' ts, 2*xs(1Lt)'r grid on title('TEST PLOT of TWO SINUSOIDS (scaling 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, i.e. r(t)-Ae-bt cos(wt + ) 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 0.8 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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

3.2. Show how you could use the LSE equations to solve Problem 3.1.

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago