📄 logdemo.m
字号:
% Simple demonstration of using the control algorithm to stablize the fixed% point in the logistic map. See the readme file for an overview of the% demos available in this directory.% m = 1 (length of time-delayed sequence)% n = 1 (length of the control sequence)% d = 0 (delay time before control perturbations reach system output).% neighbors = 20 (number of the nearest neighbors used for the surface% approximation% niter=300 Number of points to keep for global approximation% This demo requires the folowing subroutines:% contr.m - nonlinear controller% idseq.m - identification sequence builder% ctrseq.m - control sequence builder% logsim.m - the logistic map% linint.m - nearest neighbor tangential plane approximation% delaysig2.m - an extended version of delaysig.m% Copyright (c) 1998 The University of Texas at Austinclear all;clf;% Dimensionality of the systemm=1;d=0;n=1;neighbors=20;niter=300;u=[0]; %Initial perturbationfor i=1:500 y=logsim(u); %iterate the logistic map with the addition of the %perturbation (u)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Initially we iterate the logistic map without perturbations%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Next we apply random perturbations and collect the responces (mode=0)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if( i > 100 & i < 301 ) u=contr(y, Inf, 0, 0, [.05], niter, m, n, d, neighbors); end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Second stage is the adaptive approach to the steady state with%control activated but random perturbations still added, (mode=2)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if(i > 300 & i < 401) u=contr(y, Inf, 0, 2, [0.015], niter, m, n, d, neighbors); end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Control is finally activated to reach the goal unstable state (mode=1)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if(i > 400) u=contr(y, Inf,0,1,[.01], niter, m, n, d, neighbors); end%The rest is just for display xs(i)=y; us(i)=u; ind=(1:i); subplot(2,1,1), plot(ind,xs(ind)),title 'y', axis([1 500 0 1]); subplot(2,1,2), plot(ind,us(ind)),title 'u', axis([1 500 -0.1 0.1]); drawnowend subplot(2,1,1), plot(1:i,xs(:)),title 'y'; subplot(2,1,2), plot(1:i,us(:)),title 'u';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -