# Mathematical coding help

Hello,

Anyone here good with mathematical codes?

I am trying to create a task that uses a circle to mimic a breathing pacer. So a circle that slowly grows bigger in size (inflation) and then slowly shrinks in size (deflation). I am hoping to modify the rate of this rhythm.

At the moment, I am using this equation in the coder:
inflate = P*sin((1/M)*t)

“Inflate” is the name I have given the circle
P = size of the circle
N = time to get to maximum circle size

If I use this equation; inflate = 20*sin((1/2)*t); it produces an inflation rate of 6.2 seconds and deflation rate of 6.2 seconds.

However, I am trying to get the inflation and deflation rate to differ. For example, inflation for 4 seconds and deflation for 6 seconds.

I have been using this website to try and figure out the best way to code for this: Skewed Sinusoid

Any help will be much appreciated,

Thank you

Dani

I thought I’d seen this before.

Does a of 1.5 and b of -0.7 give you about what you need?

Thank you for your reply! I hope its okay to repost the same question on this forum?

I have changed the code:

P*sin((1/M)*t+0.1 *sin(1/M)*t))

I will try this and let you know how I go.

1.5*sin((1/-0.7)*t+0.1 *sin((1/-0.7)*t))

*edit

First equation I tried it with, came out with a very small circle that was increasing and decreasing in size quite rapidly.

Second equation I tried produced a similar effect

That’s not the equation on the link you shared.

There is an example in the PsychoPy textbook that uses a sin function raised to the 4th power to create the sort of temporal asymmetry that makes a stimulus look like a beating heart (this link should hopefully take you directly to page 83):