Question

Create a file named “toneA.m” with the following MATLAB code: clear all Fs=5000; Ts=1/Fs; t=[0:Ts:0.4]; F_A=440;...

Create a file named “toneA.m” with the following MATLAB code:

clear all

Fs=5000;

Ts=1/Fs;

t=[0:Ts:0.4];

F_A=440; %Frequency of note A is 440 Hz

A=sin(2*pi*F_A*t);

sound(A,Fs);

Type toneA at the command line and then answer the following:

(a) What is the time duration of A?

(b) How many elements are there in A?

(c) Modify toneA.m by changing “Fs=5000” to “Fs=10000”. Can you hear any

difference?

(d)

Create a file named “tone.m” with the following MATLAB code:

function x = tone(frequency, observation_length);

% x=tone(frequency, observation_length) is used to generate

% a sinusoidal signal x with frequency and observation

% length specified in the arguments.

fs = 5000;

Ts = 1/fs;

t = [0:Ts:observation_length];

x = cos(2*pi*frequency*t);

Note that tone is a user-defined MATLAB function. Try the following commands:

help tone and y=tone(20,0.5). What are the uses of these two commands?

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Create a file named “toneA.m” with the following MATLAB code: clear all Fs=5000; Ts=1/Fs; t=[0:Ts:0.4]; F_A=440;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts...

    Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts = 1/fs; % Number of samples, assume 1000 samples l = 1000; t = 0:1:l-1; t = t.*ts; % Convert the sample index into time for generation and plotting of signal % Frequency and amplitude of the sensor f1 = 110; a1 = 1.0; % Frequency and amplitude of the power grid noise f2 = 60; a2 = 0.7; % Generating the sinusoidal waves...

  • matlab help, please my code is here: %% exercise2 %a Fs = 8000; % sampling frequency tn = 0:1/Fs:0.005; % here, bit dura...

    matlab help, please my code is here: %% exercise2 %a Fs = 8000; % sampling frequency tn = 0:1/Fs:0.005; % here, bit duration is 0.005s instead of 1/300s phi1 = 0; phi0 = 0; % phases of the sinusoid x1 = cos(2*pi*1650*tn + phi1); % tone for binary 1 x0 = cos(2*pi*1850*tn + phi0); % tone for binary 0 xx = [x1, x0]; % FSK signal for ¡°1,0¡± tt = [tn, tn + 0.005]; % time figure(1) plot(tt, xx); %...

  • You are given a finite step function xt=-1  0<t<4 1  4<t<8.           Hand calculate the FS coefficients of...

    You are given a finite step function xt=-1  0<t<4 1  4<t<8.           Hand calculate the FS coefficients of x(t) by assuming half- range expansion, for each case below. Modify the code below to approximate x(t) by cosine series only (This is even-half range expansion). Modify the below code and plot the approximation showing its steps changing by included number of FS terms in the approximation. Modify the code below to approximate x(t) by sine series only (This is odd-half range expansion).. Modify...

  • Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2...

    Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2*pi*1000*t); figure; plot(t,y1); xlabel('t (second)') ylabel('y(t)') axis([0,.004,-1.2,1.2]) % constrain axis so you can actually see the wave sound(y1,fs); % play sound using windows driver. %% % Check the frequency domain signal. fr is the frequency vector and f1 is the magnitude of F{y1}. fr=([0:no_pts-1]')/no_pts*fs; %in Hz fr=fr(1:no_pts/2); % single-sided spectrum f1=abs(fft(y1)); % compute fft f1=f1(1:no_pts/2)/fs; %% % F is the continuous time Fourier. (See derivation...

  • Write an M-file to produce a desired note, expressed in piano key number, for a given...

    Write an M-file to produce a desired note, expressed in piano key number, for a given duration. Your M-file should be in the form of a function called key2note.m. Your function should have the following form: function xx = key2note(X, keynum, dur, fsamp) % KEY2NOTE Produce a sinusoidal waveform corresponding to a % given piano key number % % usage: xx = key2note (X, keynum, dur) % % xx = the output sinusoidal waveform % X = complex amplitude for...

  • This is all suppose to be a 1 file code in Matlab For the three problems...

    This is all suppose to be a 1 file code in Matlab For the three problems below create one script, HW8.m and upload it to Blackboard. Each problem must begin with the following lines of code: %Problem # (Insertproblem number) clear (clears workspace) Nothing should write to the screen except for the information requested in each problem. Le use semi-colons throughout your code. Problem 1. An industrial process of water flows through three tanks in succession as illustrated in the...

  • Create a new MATLAB Script file named MT3P3_itname.m. In your script file perform the following calculations:...

    Create a new MATLAB Script file named MT3P3_itname.m. In your script file perform the following calculations: Prompt the user to enter an integer. Use a multiple if-elseif structure to determine the following: Confirm that the number is an integer. If not, the program displays message 1. Check if the number is divisible by 2 and displays message 2. Check if the number is divisible by 3 and displays message 3. For anything other than 1, 2, or 3, the program...

  • A classic second order system has transfer function the undamped natural frequency to be 10 rad/s throughout this exercise. Note, for the following MATLAB simulations you need to use format long defi...

    A classic second order system has transfer function the undamped natural frequency to be 10 rad/s throughout this exercise. Note, for the following MATLAB simulations you need to use format long defined at the top of the program to get full precision. a) Use MATLAB to plot the step response for three damping factors of ζ =0.5,1 and 1.5 respectively. step(g,tfinal)_ where tfinal is the max time you need to make it 2 secs and g is the b) Takeζ...

  • Please write the code using matlab 1) i. Create an anonymous function named optimist, that accepts...

    Please write the code using matlab 1) i. Create an anonymous function named optimist, that accepts a single variable as input i Create a row vector Tthat represents the number of seconds in two minutes, starting ii. Call the function optimist on the vector T, store the result in variable R1 and returns the double of that variable from one and ending at a hundred and twenty v. Create an anonymous function named pessimist, that accepts a single variable as...

  • Consider the following MATLAB code using the handel.mat example file that comes with MATLAB: >> load...

    Consider the following MATLAB code using the handel.mat example file that comes with MATLAB: >> load handel; >> ys = y(1000:1000+100); >> ysw = ys.*blackman(length(ys)); >> [X,f] = SpectrumAnalysis(ysw,Fs,2^12); where SpectrumAnalysis is a user defined function that computes an N-point FFT (i.e. 2^12 points), to an input signal ys with a sampling frequency Fs. Which of the following statements about the spectrum of ys is correct? A) The effect of using the blackman window is that the sidelobes due to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT