CODE FOR Reconstructing nonlinear networks subject to fast-varying noises by ...

来源:互联网 发布:淘宝中老年棉睡衣 编辑:程序博客网 时间:2024/06/05 06:37

%%% There are two m files
%%% ODELorenz.m produces a Lorenz orbital program containing noise
%%% RestrLorenz.m with the data to reconstruct the parameters of the program

%%% RestrLorenz.m
clc,clear
load(‘Lorenz.mat’)%data
A0 = [-10,10,0,0,0,0,0,0,0;28,-1,0,0,0,-1,0,0,0;0,0,-2,1,0,0,0,0,0];%Lorenz actual parameters
N = 10^7;%The amount of data
h=10^(-4);
tau = 0.03;%Sampling step
t = floor(tau/h);

L = zeros(9,N);%base
L(1,:) = DataMat(:,1);
L(2,:) = DataMat(:,2);
L(3,:) = DataMat(:,3);
L(4,:) = DataMat(:,1).*DataMat(:,2);
L(5,:) = DataMat(:,2).*DataMat(:,3);
L(6,:) = DataMat(:,1).*DataMat(:,3);
L(7,:) = DataMat(:,1).^2;
L(8,:) = DataMat(:,2).^2;
L(9,:) = DataMat(:,3).^2;

St = L(:,1+t:N)*L(:,1:N-t)’/(N-t);
S0 = L*L’/N;

A = logm(St*(S0^-1))/(t*h);%Reconstruction results
D = -(A*S0+S0*A’);%Noise

A0plus = reshape(A0(:,1:min(length(S0),10)),1,[]);
Aplus = reshape(A(1:3,1:min(length(S0),10)),1,[]);

FS = 20;
FZ = 15;
LW = 1.5;
figure
for i = 1:length(Aplus)
plot(A0plus(i),Aplus(i),’ro’,’linesmoothing’,’on’,’LineWidth’,LW)
hold on
end

Endpoint1 = floor(min([min(A0plus),min(Aplus)])*2);
Endpoint2 = ceil(max([max(A0plus),max(Aplus)])*1.2);
plot([Endpoint1,Endpoint2],[Endpoint1,Endpoint2],’linesmoothing’,’on’,’LineWidth’,LW)
axis([Endpoint1,Endpoint2,Endpoint1,Endpoint2])
set(gca,’FontSize’,FZ);
xlabel(‘Aij’,’FontSize’,FS,’Interpreter’,’LaTeX’)
ylabel(‘A^ij(n=10)’,’FontSize’,FS,’Interpreter’,’LaTeX’)
title([‘τ=’,num2str(t*h)],’FontSize’,FS,’Interpreter’,’LaTeX’)

figure
for i = 1:3
for j = 1:3
if i == j
plot(100,D(i,j),’ro’,’linesmoothing’,’on’,’LineWidth’,LW)
hold on
else
plot(0,D(i,j),’ro’,’linesmoothing’,’on’,’LineWidth’,LW)
hold on
end
end
end
plot([-10,110],[-10,110],’linesmoothing’,’on’,’LineWidth’,LW)
axis([-10,110,-10,110])
set(gca,’FontSize’,FZ);
title([‘τ=’,num2str(t*h)],’FontSize’,FS,’Interpreter’,’LaTeX’)
xlabel(‘Dij’,’FontSize’,FS,’Interpreter’,’LaTeX’)
ylabel(‘D^ij’,’FontSize’,FS,’Interpreter’,’LaTeX’)

%%% ODELorenz.m

function ODELorenz()
clc,clear
h=10^(-4);%Step length
n=10^(7);%The amount of data
D = 100;%Noise intensity
DataMat = zeros(n,3);

for i = 1:n-1
DataMat(i+1,:) = DataMat(i,:) + h * Lorenz(DataMat(i,:)’)’+sqrt(D*h)*randn(1,3);%Euler method
if mod(i,n/100)==0
disp(i/(n/100));
end
end

save Lorenz.mat DataMat

FS = 20;
FZ = 15;
LW = 1.5;
figure
plot(DataMat(:,1),DataMat(:,2)) %Phase Diagrams
xlabel(‘x’,’FontSize’,FS,’Interpreter’,’LaTeX’)
ylabel(‘y’,’FontSize’,FS,’Interpreter’,’LaTeX’)
title(‘Phase~Diagrams’,’FontSize’,FS,’Interpreter’,’LaTeX’)

function dx = Lorenz(x) %Lorenz equation

dx=zeros(3,1);
o = 10;
% b = 8/3;
b = 2;
p = 28;

dx(1) = o*(x(2)-x(1));
dx(2) = x(1)*(p - x(3)) - x(2);
dx(3) = x(1)*x(2) - b*x(3);

阅读全文
0 0
原创粉丝点击