Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Beat Notes (a) Write an M-?le called beat.m that implements x(t) = Acos(2?(fc ?f

ID: 1847383 • Letter: B

Question

Beat Notes



(a) Write an M-?le called beat.m that implements

x(t) = Acos(2?(fc ?f?)t)+ Bcos(2?(fc + f?)t)

and has the following as its ?rst lines:

function [xx, tt] = beat(A, B, fc, delf, fsamp, dur)

%BEAT compute samples of the sum of two cosine waves

% usage:

% [xx, tt] = beat(A, B, fc, delf, fsamp, dur)

%

% A = amplitude of lower frequency cosine

% B = amplitude of higher frequency cosine

% fc = center frequency

% delf = frequency difference

% fsamp = sampling rate

% dur = total time duration in seconds

% xx = output vector of samples

%--Second Output:

% tt = time vector corresponding to xx


The function should also generate its own time vector, because that vector can be used to de?ne the horizontal axis when plotting.

Explanation / Answer


a)Here's the code.....


function [x, t] = beat(A, B, fc, delf, fsamp, dur)


%%assuming the function "x" starts at t=0

t= 0:1/fsamp:dur;


x = A*cos(2*pi*(fc -delf)*t)+ B*cos(2*pi*(fc + delf)*t);


end