Question: MUST BE IN MATLAB FORMAT 1A) generate_square_wave Write a function called generate_square_wave that generates a square wave. The desired amplitude , number of periods ,

MUST BE IN MATLAB FORMAT

1A) generate_square_wave

Write a function called generate_square_wave that generates a square wave. The desired amplitude, number of periods, and number of samples per period (a.k.a. # of data points in each period) are passed into the function. The function returns a row vector containing the y values of a square wave. For example, if the following code was executed:

y = generate_square_wave(3, 10, 100); t = 0:length(y)-1; plot(t,y, '.-');
 

B) generate_triangle_wave

Write generate_triangle_wave(), which has the same input and output parameters as generate_square_wave(). If the above code instead called generate_triangle_wave()

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!