- #1

- 1,266

- 11

## Main Question or Discussion Point

I want to find q

n≥2,

q

q

I thought it's easier to do this on Matlab & I tried to write a script file for this problem:

I don't know why my code isn't working/giving the right answer. Does anyone know what's the problem with this script?

_{501}for the difference equation:**q**_{n}=q_{n-1}- 0.001 q^{2}_{n-2}n≥2,

q

_{0}=1,q

_{1}=2I thought it's easier to do this on Matlab & I tried to write a script file for this problem:

Code:

```
k=0.001
q(1)=1
q(2)=2
for n=1:502
q_n=q_n-1-k*(q_n-2)^2
end
```