Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I was wondering how you can get this to work in MatLab:

input is n

for i from 1 to n

x0 = 1

xi = x(i-1) + 2

So that for i = 1, x1 = x0 +2, or x1 = 1 + 2

Is there anyway to express this in MatLab?

Thanks!

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab Question: variables that depend on previous variables

**Physics Forums | Science Articles, Homework Help, Discussion**