Merge pull request #17 from ltcptgeneral/bz010-patch-2

Update generate_sawtooth.m
This commit is contained in:
Ben Zhang 2021-12-05 21:09:19 -08:00 committed by GitHub
commit 79016660ff
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:
% Ben Zhang: Function author
% Arthur Lu: Format author
% DOCUMENTATION:
% 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
if(st < mid)
x(i) = slope * st;
x(i) = slope * st; % amplitude from start to +amplitude
%part after the straght vertical line
else
x(i) = slope * (st - 0.5) - amplitude;
x(i) = slope * (st - 0.5) - amplitude; %amplitude from -amplitude to start
end
end