MATLAB CODE PLOT TRIANGULAR WAVE AND ITS DERIVATIVE:
f0=50;
fs=500;
t=0:1/fs:0.4; %time vector
tri=sawtooth(2*pi*f0*t,1/2); %triangular wave
subplot(2,1,1)
plot(t,tri)
xlabel('time')
ylabel('Triangular wave')
title('Aylins signal')
t1=0:1/fs:(0.4-1/fs);
der_tri=diff(tri); % derivative of triangular wave
subplot(2,1,2)
plot(t1,der_tri)
xlabel('time')
ylabel('Derivative of triangular wave')
title('Aylins signal Derivative')
Plot:
Q1. Plot 20 periods of a triangle wave and its' derivative with a fundamental frequency of 50 Hz....
Q1. Plot 20 periods of a triangle wave and its' derivative with a fundamental frequency of 50 Hz. The sample rate is 500 Hz. Set the time vector as [o, 0.4] and increase by 1/f, Use subplot and grid on commands, label all the axes and name the graph with your name, i.e: Aylin's Signal, Aylin's Signal Derivative. (10 pts) Hint: Use sawtooth function, in order to obtain fully triangular wave, construct the signal as sawtooth (wt, 1/2)