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

Generate Matlab code that follows the specifications below: Generate a pulse sig

ID: 1716345 • Letter: G

Question

Generate Matlab code that follows the specifications below: Generate a pulse signal X possessing a magnitude equal to one between 0 and 1 seconds AND an amplitude of zero between 1 and 2 seconds. Generate a unit step signal Y from 0 to 2 seconds. Convolve signal X and Y. Save the answer in vector Z. Given that Matlab performs discrete time convolution, what would be the dimensions of vector Z? Graph X and Y versus time in two different graphs using the subplot() function. Each one second interval should contain 1000 elements and make sure you suppress any output.

Explanation / Answer

1) Pulse signal

  1. fs=500; %sampling frequency
  2. T=2; %width of the rectangule pulse in seconds
  3. t=0:2/fs:0.5; %time base
  4. x=rectpuls(t,T); %generating the square waveplot(t,x,'k');
  5. title(['Rectangular Pulse width=', num2str(T),'s']);
  6. xlabel('Time(s)');
  7. ylabel('Amplitude');