[R] create waveform sawtooth

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Mar 29 00:36:40 CEST 2012



On 26.03.2012 19:33, R. Michael Weylandt wrote:
> Perhaps something like this,
>
> x<- seq(0, 10, length = 1000)
> y<- x %%1


Or if people like a package:

library("tuneR")
st <- sawtooth(10)
plot(st)

Uwe Ligges


> Michael
>
> On Mon, Mar 26, 2012 at 10:18 AM, mail me<mailme842 at googlemail.com>  wrote:
>> Hi:
>>
>> I am trying to create a sawtooth waveform. I used the following
>>
>> x<- runif(500, min = -2, max = 2)
>> y<- (1 -abs(x3))* ((x3)<= 1)
>> combined<- data.frame(x = x3, y = y3)
>> plot(combined)
>>
>> and I get a triangular waveform, not sawtooth. Can someone give a
>> solution to create a sawtooth waveform?
>>
>> Thanks
>> deb
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list