You might find the sawtooth function helpful for generating a triangular pulse: https://in.mathworks.com/help/signal/ref/sawtooth.html.
Here's an example directly from the documentation that you can adjust as needed.
"sampling frequency of 20k and having a pulse width of 4.25 ms".
T = 10*(1/50);
fs = 1000;
t = 0:1/fs:T-1/fs;
x = sawtooth(2*pi*50*t);
plot(t,x)
grid on
Karan