www.gusucode.com > signal 案例源码程序 matlab代码 > signal/AsymmetricSawtoothWaveformExample.m

    %% Asymmetric Sawtooth Waveform
% This example generates an asymmetric sawtooth waveform with a repetition
% frequency of 3 Hz and a sawtooth width of 0.1 s. The signal length is 1 s
% and the sample rate is 1 kHz.

% Copyright 2015 The MathWorks, Inc.


%%

t = 0 : 1/1e3 : 1;         % 1 kHz sample freq for 1 s
d = 0 : 1/3 : 1;           % 3 Hz repetition frequency
y = pulstran(t,d,'tripuls',0.1,-1);

plot(t,y)
xlabel 'Time (s)', ylabel Waveform