title: Help writing a recurrence relation in MATLAB
body: <p>I have this recurrence relation which is defined as:</p>
  
  <p>$x_{j+1}-2x_j+x_{j-1}=1$</p>
  
  <p>$j=1,2,...$</p>
  
  <p>My task is to write two MATLAB functions, the first one should generate a fixed number $n$ of elements of the sequence $x_j$. The only user input should be $n$.</p>
  
  <p>The second function should compute terms up until $x_j &gt; x_{max}$ and then stop. The value $x_{max}$ should be the input.</p>
  
  <p>In both cases, I need to provide two initial conditions chosen at random in $(0, 1)$ in the code.</p>
  
  <p>Can anyone help me here?</p>
  
  <p>EDIT: I can't seem to add comments - sorry I didn't realise this was the wrong area, can someone delete this question?</p>