The triangle waveform starts at its lowest value, rather than its midpoint, like a sine or cosine. This basically represents a phase shift; it is best that that be avoided.
|
function y = triangle(f, t) |
|
% TRIANGLE Generate a triangle wave with values in range [0, 1] |
|
% Y = TRIANGLE(F, T) |
|
% F = number of triangles per second |
|
% T = array of times |
|
y = min(rem(t,1/f)/(1/(2*f)), ((1/f)-rem(t,1/f))/(1/(2*f))); |
|
end |
The triangle waveform starts at its lowest value, rather than its midpoint, like a sine or cosine. This basically represents a phase shift; it is best that that be avoided.
Signal-Computing/Matlab/AnalogSignal.m
Lines 235 to 241 in b8424f5