(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

Hi. I sort of doubt that anyone will reply to this post since it is a matlab problem, but ill give it a shot.

I am trying to write a matlab function that will graph the logistic map.

2. Relevant equations

x(n+1) = r*xn*(1-xn) (1)

The inputs are r, x0 and N.

I want the function to store the sequence x1, x2, . . . , xN given by (1) as the components of a vector x and plots them with respect to n.

3. The attempt at a solution

function [x_i+1]=logistic_map(r,x0,N)

% [x]=logistic_map(r,x0,N)

% the initial condition is x0

% x depends on scalars r, x0, N

% the function computes xn+1 = r*xn(1-xn)

for i = 1:N

x_i+1 = r*x0*(1-x0)

end

plot(1:N,x_i+1)

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

Dismiss Notice

Join Physics Forums Today!

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

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

# Matlab - I am having problems with iteration (loops)

Loading...

Similar Threads for Matlab having problems |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Matlab-like software |

MATLAB Matlab data into bins |

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