Update generate_sawtooth.m

edit comments
This commit is contained in:
Ben Zhang 2021-12-05 21:09:12 -08:00 committed by GitHub
parent b5158c6e83
commit 2e950c69ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,6 @@ function x = generate_sawtooth(amplitude, frequency, phase, fs, duration, duty)
% CONTRIBUTORS: % CONTRIBUTORS:
% Ben Zhang: Function author % Ben Zhang: Function author
% Arthur Lu: Format author
% DOCUMENTATION: % DOCUMENTATION:
% phase shift is in number of periods % phase shift is in number of periods
@ -31,11 +30,11 @@ function x = generate_sawtooth(amplitude, frequency, phase, fs, duration, duty)
%part before the straght vertical line %part before the straght vertical line
if(st < mid) if(st < mid)
x(i) = slope * st; x(i) = slope * st; % amplitude from start to +amplitude
%part after the straght vertical line %part after the straght vertical line
else else
x(i) = slope * (st - 0.5) - amplitude; x(i) = slope * (st - 0.5) - amplitude; %amplitude from -amplitude to start
end end
end end