0

We'll take this code:

n = 30;
x = ones(1, n);
for i=1:n
    x(i+1)=r*x(i)*(1-x(i));
endfor

The equation is just an example. Is it possible to vectorize it?

Mattia
  • 13
  • 4
  • 1
    This is very easy to vectorize, since for `i=1`: `(1-x(1))=0` and from then on `x(i)=0`. You really need to give a meaningful example to get a useful answer ... – chtz May 15 '20 at 21:47
  • You're right... so, take an acceleration: $v_2 = v_1+a*t$ (suppose that you can't analitically integrate it) – Mattia May 20 '20 at 06:25
  • `v = v_0 + a*dt*(1:n)`? – chtz May 20 '20 at 08:42

0 Answers0