# Convert a recurrence relationship into an algebraic equation

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.

-

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