[Matlab] Correlation function for henon map

In summary, to plot the correlation function for a two-dimensional system using MATLAB, you can define the Henon map function, set the parameters and initial conditions, run a loop to calculate the x and y values, and use the "corrcoef" and "bar" functions to plot the autocorrelation function.
  • #1
cadi2108
1
0
Hi!

I need to write MATLAB script, which will be plotting corretation function for two-dimmensial system. Henon map is not my system, but is very popular, so solusion for henon map can be very helpful for me.

Have anybody know code for have plot like this: http://www.physics.emory.edu/~weeks/research/time/tseries6/autohen.gif? I wrote resolusion like it for logistic map, but it give me other type of plot:

Code:
clear;

n1=400; %% no of lattice points in coordinate and parameter k1
n2=200; %% no of iterations to reach attractor
n3=400; %% no of iterations for bifurcation diagram
n4=5000; %% no of iterations for distribution and Lyapunov exponent

kk=[]; w1=[]; 

k1=3.7; 
x1=0.1; 
                  
for it1=1:n2 
  y1=k1*x1*(1-x1); x1=y1;
end 

for iter3=1:n4  
  y1=k1*x1*(1-x1); w1=[w1;y1]; x1=y1;
end 

ww=.005 + linspace(0,.99,100);

w3=round(w1);
av1=mean(w3); % > the average 
var1 = cov(w3); % > the variance
var2=var1;
ww=w3;

for iter4=1:n2
  ww=[ww(n4);ww(1:n4-1)];
  zz=cov(w3,ww);
  var2=[var2;zz];
end 

var2=var2/var1;

bar(var2);
title('Autocorrelation function for the symbolic sequence'); 
axis([0  n2  -1  1]);

Help please! Best regards.
 
Physics news on Phys.org
  • #2


Hi there!

There are a few different ways you could approach this problem, but I'll outline one possible solution using MATLAB. The first step is to define the Henon map function, which takes in the current x and y values and returns the next x and y values based on the Henon map equations:

function [x_next, y_next] = henon(x, y, a, b)
x_next = 1 - a*x^2 + y;
y_next = b*x;
end

Next, we can define the parameters and initial conditions for our system:

a = 1.4; % parameter a for Henon map
b = 0.3; % parameter b for Henon map
x0 = 0.1; % initial x value
y0 = 0.1; % initial y value
n = 5000; % number of iterations to reach attractor
m = 400; % number of iterations for correlation function
x = zeros(n, 1); % preallocate arrays for x and y values
y = zeros(n, 1);

Now, we can run a loop to calculate the x and y values for each iteration and store them in the arrays:

for i = 1:n
[x(i+1), y(i+1)] = henon(x(i), y(i), a, b);
end

Now, we can plot the Henon map attractor by plotting the x and y values:

figure;
plot(x, y);
xlabel('x');
ylabel('y');
title('Henon Map Attractor');

To calculate the autocorrelation function, we can use the built-in MATLAB function "corrcoef". This function calculates the correlation coefficient between two variables, in this case the x and y values at different time lags. We can then plot these values as a function of the time lag using the "bar" function:

figure;
corr = zeros(m, 1); % preallocate array for correlation function
for j = 1:m
corr(j) = corrcoef(x(1:end-j), y(j+1:end)); % calculate correlation coefficient
end
bar(corr);
xlabel('Time lag');
ylabel('Correlation coefficient');
title('Autocorrelation Function for Henon Map');

I hope this helps! Let me know if you have any questions or if you need further clarification. Good luck with your project!
 

1. What is the Henon map in Matlab?

The Henon map is a chaotic map used to generate a two-dimensional system. In Matlab, it is implemented as a function that takes in two input parameters, a and b, and returns a matrix of coordinates.

2. How do I calculate the correlation function for the Henon map in Matlab?

To calculate the correlation function for the Henon map in Matlab, you can use the built-in function "xcorr." This function takes in two input vectors, which in this case would be the x and y coordinates generated by the Henon map, and returns the correlation values between them.

3. Can the correlation function for the Henon map be used to analyze chaotic systems?

Yes, the correlation function for the Henon map can be used to analyze chaotic systems. It can provide insights into the behavior and patterns of the system, such as the presence of periodic points or the level of randomness in the system.

4. Can I plot the correlation function for the Henon map in Matlab?

Yes, you can plot the correlation function for the Henon map in Matlab using the "plot" function. This will create a graph that shows the correlation values over time, allowing you to visualize the patterns and behavior of the system.

5. Are there any limitations to using the correlation function for the Henon map in Matlab?

One limitation of using the correlation function for the Henon map in Matlab is that it may not be effective for highly complex or nonlinear systems. In these cases, more advanced methods of analysis may be needed to fully understand the system's behavior.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
886
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
Replies
1
Views
6K
Back
Top