Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ONLY NEED PARTS C, D, AND E DO NOT DO PART A, B, OR C !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Given Code 1. The following is a demo showing

ONLY NEED PARTS C, D, AND E DO NOT DO PART A, B, OR C !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

image text in transcribed

Given Code

image text in transcribed

1. The following is a demo showing how to generate a tone (i.e., a sinusoid) in MATLAB and listen to it with the sound command. The frequency of your tone is 2 kHz, and the duration is 1 sec. The following lines of code should be saved in a file called mytone.m and run from the command line. Problem: 440Hz is the frequency of A above middle C on a musical scale It is often used as the reference note for tuning purpose. Modify the code above to play the note A from your computer. Add a phase shift of T/6. Adjust the parameter sps. Following is what you need to submit for this problem: (a) (5 pts) Comment on the effect of different values of sps (b) (10 pts) Submit both the code and the plot. Note that you probably cannot tell anything from the plot because it's too dense. Explore the MATLAB command axis by help axis such that you only print out a portion of the plot. Choose a range such that you can tell it's a sinusoid and can figure out the frequency and the phase. (c) (15 pts) It is kind of inconvenient to have to go into the code and modify parameters each time you want to explore some new settings. Write a function in the form of function x - tone (F, dur, sps, A, phase). Play notes B and C. (d) (10 pts) Write a function that plays a scale in C major using the function tone. Note that you need to figure out the relationships between the frequencies of each note on the scale, (e) (5 pts) Play around the given function function x - beat (fc, fdel, F, dur) that generates the beating note effect with the sum of two sinusoids of very close frequency. fc is the central frequency, fdel is the deviation from the central frequency. % clear the environment clear ALL; % clear buffer % clear figure % specify parameters dur 5.0 F - 2000; sps30 A - 10; phase - 0; % duration % fundamental frequency of the tone % samples per period % amplitude % phase % generate the signal t 03(1/F/sps ) : dur ; x A* co s (2x pi*F* t +phase); % the time index signal % the x(t) % plot the signal plot(t ,x); title ('Sinusoidal signal x(t) '); xlabel('Time t (sec) '); % plot the signal label('Amplitude '); grid on; % play the signal sound(x); % sound it out 1. The following is a demo showing how to generate a tone (i.e., a sinusoid) in MATLAB and listen to it with the sound command. The frequency of your tone is 2 kHz, and the duration is 1 sec. The following lines of code should be saved in a file called mytone.m and run from the command line. Problem: 440Hz is the frequency of A above middle C on a musical scale It is often used as the reference note for tuning purpose. Modify the code above to play the note A from your computer. Add a phase shift of T/6. Adjust the parameter sps. Following is what you need to submit for this problem: (a) (5 pts) Comment on the effect of different values of sps (b) (10 pts) Submit both the code and the plot. Note that you probably cannot tell anything from the plot because it's too dense. Explore the MATLAB command axis by help axis such that you only print out a portion of the plot. Choose a range such that you can tell it's a sinusoid and can figure out the frequency and the phase. (c) (15 pts) It is kind of inconvenient to have to go into the code and modify parameters each time you want to explore some new settings. Write a function in the form of function x - tone (F, dur, sps, A, phase). Play notes B and C. (d) (10 pts) Write a function that plays a scale in C major using the function tone. Note that you need to figure out the relationships between the frequencies of each note on the scale, (e) (5 pts) Play around the given function function x - beat (fc, fdel, F, dur) that generates the beating note effect with the sum of two sinusoids of very close frequency. fc is the central frequency, fdel is the deviation from the central frequency. % clear the environment clear ALL; % clear buffer % clear figure % specify parameters dur 5.0 F - 2000; sps30 A - 10; phase - 0; % duration % fundamental frequency of the tone % samples per period % amplitude % phase % generate the signal t 03(1/F/sps ) : dur ; x A* co s (2x pi*F* t +phase); % the time index signal % the x(t) % plot the signal plot(t ,x); title ('Sinusoidal signal x(t) '); xlabel('Time t (sec) '); % plot the signal label('Amplitude '); grid on; % play the signal sound(x); % sound it out

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

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago