User Tools

Site Tools


4rpl:commands:signalgenerator

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4rpl:commands:signalgenerator [2025/09/02 17:12] – [Sine wave in any direction without gaps] kalli4rpl:commands:signalgenerator [2025/09/03 16:43] (current) – [Sine wave in any direction without gaps] kalli
Line 144: Line 144:
 ==== Sine wave in any direction without gaps ==== ==== Sine wave in any direction without gaps ====
 {{ :4rpl:commands:sinewaveanydirection.png?nolink&600 |}} {{ :4rpl:commands:sinewaveanydirection.png?nolink&600 |}}
 +
 <code 4RPL>  <code 4RPL> 
 30 30 v2 165 91 v2 15 4.5 0 @getSinusoidCells ->list 30 30 v2 165 91 v2 15 4.5 0 @getSinusoidCells ->list
Line 155: Line 156:
  <-cell1 <-cell0 sub ->dir  <-cell1 <-cell0 sub ->dir
  <-dir.0 abs <-dir.1 abs max ->length  <-dir.0 abs <-dir.1 abs max ->length
- <-dir <-length asfloat div ->dirL+ <-length eq0 if 0 0 v2 else <-dir <-length asfloat div endif ->dirL
  <-cell0  <-cell0
- <-length do+ <-length do
  dup <-dirL add  dup <-dirL add
  loop  loop
- <-length listN+ <-length 1 add listN
   
 :getSinusoidCells # INPUTS: <-startCell <-endCell <-amplitude <-intervals <-phaseShift01. OUTPUT: a list of cells. :getSinusoidCells # INPUTS: <-startCell <-endCell <-amplitude <-intervals <-phaseShift01. OUTPUT: a list of cells.
Line 167: Line 168:
 ->ampl ->ampl
 ->cell1 ->cell1
-dup ->cell0 ->prevCell+->cell0
  
 clearstack clearstack
Line 176: Line 177:
 <-dir.1 <-dir.0 neg v2 <-ampl mul ->dirP <-dir.1 <-dir.0 neg v2 <-ampl mul ->dirP
  
-<-axisLength do +<-cell0 
- <-axisCells[i] i <-freq <-shift 0 1 signalgenerator <-dirP mul add <-prevCell swap dup2 sub magnitude if +<-axisLength do 
- ->prevCell @getSingleLineCells ListToStack + i <-freq <-shift 0 1 signalgenerator <-dirP mul <-axisCells[i] add @getSingleLineCells ListToStack
- else +
- pop ->prevCell +
- endif+
 loop loop
-list dup 0 removelistelement+list
  
 </code> </code>
  
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
4rpl/commands/signalgenerator.1756833167.txt.gz · Last modified: 2025/09/02 17:12 by kalli