Notifications
Clear all

[Closed] Wavelength with Sin

 3ak

Here is possible solution with damping.
another way is to use something like sin(t)/t but you need to include if statement to avoid div by zero – > if t==0 then f(t) = 0.

periods = 5
periodLength = 10.
amplitude = 10.
boxesPerPeriod = 20.
dampingCoef = 80.
boxsize = [1,1,1]*(units.decodevalue "1cm")

totalBoxesNum = periods*BoxesPerPeriod
step = periodLength/boxesPerPeriod

for i = 0 to totalBoxesNum do
(
	dampingZ = (exp(-i/dampingCoef))
	func = (abs(sin(180/boxesPerPeriod*i))*amplitude) * dampingZ
	obj = dummy pos:[i*step , 20, func] boxsize:boxsize 
)

If you need damping along X axis add second damping coef.

As for your code use
z = abs(sin(180.0x/num))amplitude(decayB[/B])

Along with the dampening comes two things.
A shorter wave and a lower amplitude though.

right now it is just doing a lower amplitude.

1 Reply
 3ak
(@3ak)
Joined: 11 months ago

Posts: 0

As i said in previous post – add coef. ro X axis.

periods = 5
periodLength = 10.
amplitude = 10.
boxesPerPeriod = 20.
dampingCoef = 50.
boxsize = [1,1,1]*(units.decodevalue "1cm")

totalBoxesNum = periods*BoxesPerPeriod
step = periodLength/boxesPerPeriod
x = 0
for i = 0 to totalBoxesNum do
(
	dampingZ = (exp(-i/dampingCoef))
	--print dampingZ
	func = (abs(sin(180/boxesPerPeriod*i))*amplitude) * dampingZ
	obj = dummy pos:[x , 20, func] boxsize:boxsize 
	x +=step*dampingZ^0.5
)

Just find the right numbers.

I must have not tried large enough numbers. I was messing around with what you had mentioned but was not noticeably seeing any results.

Page 2 / 2