Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma rtGlobals=1 // Use modern global access method.
- function kasia1(input)
- variable input // "input" will be the x values
- variable output=0 // output will be the y values
- variable slope1=0.4, slope2=-0.4, slope3=0, intercept1=0.5, intercept2=2.4, intercept3=0.5
- variable rangemax1=2.375, rangemax2=4.75-rangemax1, rangemax3=100-rangemax1-rangemax2, period=rangemax1+rangemax2+rangemax3
- variable delta=0
- if(input<period)
- delta=input
- else
- delta=mod(input,period)
- endif
- //print delta, period, input
- // zig-zag function
- if(delta<rangemax1)
- output = slope1*delta + intercept1
- elseif(delta<rangemax2)
- output = slope2*delta + intercept2
- else
- output=slope3*delta+ intercept3
- endif
- return output
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement