triangular wave

Ben Abbott bpabbott at mac.com
Tue May 20 06:06:47 CDT 2008


On May 20, 2008, at 3:09 AM, javier wrote:

> Sorry for my English
> Someone knows how to create a vector with a triangular wave?
> And a square wave?
>
> Something like this but with a signal triangular:
>
> seno=10*sin(2*pi*10);

Does this do what you're looking for?

n = 0:100;
a = (-1).^n;
x = 0:0.01:100;
y = interp1 (n, a, x);
plot (x, y)

There may be an existing function, but I'm not aware of it.

Ben


More information about the Help-octave mailing list