Generate Sine Wave

Easy MATLAB DSP
Solve this problem

Generate a sine wave in MATLAB given amplitude, frequency, sampling rate, and duration. Return both the time vector and the sine signal.

Constraints

  • Function prototype: function [t, y] = gen_sine(A, f, Fs, dur)
  • Use vectorized operations only.
  • y = A * sin(2*pi*f*t).
  • t must span [0, dur].
Starter codeMATLAB
1function [t,y] = gen_sine(A,f,Fs,dur)2% TODO3end