Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a piece of code that describes a recursive relationship to produce a logarithmic sweep:

StartFreq = 1;
EndFreq = 10;
SweepDuration = 100;

k = exp(ln(EndFreq/StartFreq)/SweepDuration);

freq(0) = StartFreq;
for (i=n;n<100;n++){
    freq(n) = freq(n-1)*k;

I am trying to convert this recursive relationship into an algebraic expression $f(n)$. (Actually I wanted $f(t)$, in this case here we're sampling at 1Hz so the math kind of works out in this case.) I have other code snippets that are similar but I wanted to try to solve those myself. I just kind of wanted to get a walk through the process.

share|cite|improve this question
up vote 2 down vote accepted

Perhaps I'm misunderstanding here. Your $k$ as defined is constant. Your recurrence seems to be $$f(n) = f(n-1)\cdot k$$ $$f(0) = a$$ where $a$ is your start frequency. So its simple to work out that $$f(1) = f(0)\cdot k = ak$$ $$f(2) = f(1)\cdot k = ak^2$$ $$\cdots$$ and in general $$f(n) = ak^n$$ I'm also not too sure what you meant by "I want $f(t)$".

share|cite|improve this answer
late friday is not a good time to post questions. I feel really dumb for not figuring that out on my own. – Dang Khoa Oct 8 '12 at 23:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.