Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Triangle wave generation

0 views
Skip to first unread message

Heli Golwala

unread,
May 18, 2010, 7:26:04 AM5/18/10
to
i want to generate triangle of amplitude 1. and its period shud be variable.

Wayne King

unread,
May 18, 2010, 7:40:20 AM5/18/10
to
"Heli Golwala" <helig...@yahoo.co.in> wrote in message <hsttgc$aec$1...@fred.mathworks.com>...

> i want to generate triangle of amplitude 1. and its period shud be variable.

Hi, if you have the Signal Processing Toolbox, see

>>doc triang


Wayne

John

unread,
May 18, 2010, 10:33:46 AM5/18/10
to
On 18 май, 15:26, "Heli Golwala" <heligolw...@yahoo.co.in> wrote:
> i want to generate triangle of amplitude 1. and its period shud be variable.

Simply you can do like this: plot(repmat([0.1:0.1:1 0.9:-0.1:0],1,10))
In this case I make one period of triangle and repeate it 10 times.

Best Regards,
Ivan

Walter Roberson

unread,
May 18, 2010, 10:43:39 AM5/18/10
to

That should be 0.9:-0.1:0.1
With the current code, you would get two 0's in a row.

dbd

unread,
May 18, 2010, 11:45:04 AM5/18/10
to

Actually, 0.9:-0.1:0.1 gives no 0's in a row.

This was one of those cases that was too simple to test right?

Dale B. Dalrymple

Walter Roberson

unread,
May 18, 2010, 11:55:19 AM5/18/10
to
dbd wrote:
> On May 18, 7:43 am, Walter Roberson <rober...@hushmail.com> wrote:
>> John wrote:
>>> On 18 май, 15:26, "Heli Golwala" <heligolw...@yahoo.co.in> wrote:
>>>> i want to generate triangle of amplitude 1. and its period shud be variable.
>>> Simply you can do like this: plot(repmat([0.1:0.1:1 0.9:-0.1:0],1,10))
>>> In this case I make one period of triangle and repeate it 10 times.
>> That should be 0.9:-0.1:0.1
>> With the current code, you would get two 0's in a row.
>
> Actually, 0.9:-0.1:0.1 gives no 0's in a row.

Dang, I should wait until my eyes clear in the morning before posting.

0 new messages