Skip to content

Triangle in AnalogSignal.m is phase shifted relative to sin, cos #10

Open
@stiber

Description

@stiber

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions