Question: In this section, you will write a function called syn_sin.m that will synthesize a waveform from the vectors of frequencies and complex amplitudes. You must

In this section, you will write a function called syn_sin.m that will synthesize a waveform from the vectors of frequencies and complex amplitudes. You must write the function with one loop. Below is a template that you should base your solution on:

function [xx, tt] = syn_sin(fk, Xk, fs, dur, tstart) %{ syn_sin - Function to synthesize a sum of cosine waves. usage: [xx, tt] = syn_sin(fk, Xk, fs, dur, tstart) fk = vector of frequencies (could be negative or positive) Xk = vector of complex amplitudes: A*e^(j*phi) for each fk fs = the number of samples per second for the time axis dur = total time duration of the signal tstart = starting time (default is 0, if you make this input optional)

xx = vector of sinusoidal values tt = vector of times, for the time axis Note: fk and Xk must be the same length: Xk(1) corresponds to frequency fk(1), Xk(2) corresponds to frequency fk(2), etc.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ADD YOUR FUNCTION BODY HERE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ %

Here's a description in words: your function will take in two vectors of the same length: a vector of frequencies and a vector of phasors, along with numbers for sampling frequency fs, duration dur, and start time tstart. Adapt your code, from the one_cos function in your last lab, to now process these arguments, generate a sinusoid for each frequency and phasor in the two vectors and add them together.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!