0
$\begingroup$

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.

1 Answers 1

2

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)$".

  • 0
    late friday is not a good time to post questions. I feel really dumb for not figuring that out on my own.2012-10-08