Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do number 4 please, BUT instead of doing this for a square wave, do it for a sawtooth wave! 3. Write a function, SqWave which

image text in transcribedDo number 4 please, BUT instead of doing this for a square wave, do it for a sawtooth wave!
3. Write a function, SqWave which generates a square wave of specified: duty- cycle, total time for which the wave is generated, and sampling frequency. The function should have the following inputs and outputs Inputs: Duty-cycle Total time for which the square wave is defined Sampling Frequency Outputs . Square Wave Do NOT use the Matlab function square to accomplish this task. Use the SqWave function to generate a unit amplitude, 440 Hz square-wave, ? 0.1, 0.2,.. 0.5, that lasts for 2 s. Use a sampling frequency of 44.1 kHz. Play back the tone over your speakers using the sound command. How does the perceive d tone change as you vary a? 4. Next, we will approximate the square wave with a sum of complex sinusoids Note that the Fourier series involves the summation of an infinite number of sinusoids. We will only employ a limited set of sinusoids, so we will refer to this as a truncated Fourier series. Write a function SqWaveFromFS that computes an approximate square wave using the truncated Fourier Series. It should take the same inputs as SqWave, as well as an additional input K, which refers to the number of sinusoids considered in the truncated series. The value of the square wave's amplitude at time t, is obtained by summing up a number of terms. As such, it may seem appropriate to use loops to implement this in Matlab. Your code will run very slowly if you use loops. Look up the Matlab function meshgrid and consider how you might take advantage of it to implement your Fourier Series calculations without using loops. Note: Equation 2 should yield real values. However, truncation and other errors may yield some imaginary components. In order plot or play back the approximated square wave, you may need to remove any imaginary parts

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

What is allocation?

Answered: 1 week ago

Question

=+Will the sex help meet the objectives?

Answered: 1 week ago

Question

Identify and control your anxieties

Answered: 1 week ago

Question

Understanding and Addressing Anxiety

Answered: 1 week ago