实例介绍
【实例简介】
该项目包含使用Lorentz&Rossler技术调整图像大小的matlab脚本。
【实例截图】
【核心代码】
function [x,y,z]=lorentz(n,level,s,r,b,x0,y0,z0,h)
%Syntax: [x,y,z]=lorentz(n,level,s,r,b,x0,y0,z0,h)
%_________________________________________________
%
% Simulation of the Lorentz ODE.
% dx/dt=s*(y-x)
% dy/dt=r*x-y-xz
% dz/dt=x*y-b*z;
%
% x, y, and z are the simulated time series.
% n is the number of the simulated points.
% level is the noise standard deviation divided by the standard deviation of the
% noise-free time series. We assume Gaussian noise with zero mean.
% s, r, b, and s are the parameters
% x0 is the initial value for x.
% y0 is the initial value for y.
% z0 is the initial value for z.
% h is the step size.
%
%
% Notes:
% The time is n*h.
% The integration is obtained by the Euler's method.
%
%
% Reference:
%
% Lorentz E N (1963): Deterministic nonperiodic flow. Journal of the
% Atmosphairic Sciences 20: 130-141
%
%
% Alexandros Leontitsis
% Department of Education
% University of Ioannina
% 45110 - Dourouti
% Ioannina
% Greece
%
% University e-mail: me00743@cc.uoi.gr
% Lifetime e-mail: leoaleq@yahoo.com
% Homepage: http://www.geocities.com/CapeCanaveral/Lab/1421
%
% 16 Nov 2001
if nargin<1 | isempty(n)==1
n=500;
else
% n must be scalar
if sum(size(n))>2
error('n must be scalar.');
end
% n must be positive
if n<0
error('n must be positive.');
end
% n must be an integer
if round(n)-n~=0
error('n must be an integer.');
end
end
if nargin<2 | isempty(level)==1
level=0;
else
% level must be scalar
if sum(size(level))>2
error('level must be scalar.');
end
% level must be positive
if level<0
error('level must be positive.');
end
end
if nargin<3 | isempty(s)==1
s=16;
else
% s must be scalar
if sum(size(s))>2
error('s must be scalar.');
end
end
if nargin<4 | isempty(r)==1
r=45.92;
else
% r must be scalar
if sum(size(r))>2
error('r must be scalar.');
end
end
if nargin<5 | isempty(b)==1
b=4;
else
% b must be scalar
if sum(size(b))>2
error('b must be scalar.');
end
end
if nargin<6 | isempty(x0)==1
x0=0.1;
else
% x0 must be scalar
if sum(size(x0))>2
error('x0 must be scalar.');
end
end
if nargin<7 | isempty(y0)==1
y0=0.1;
else
% y0 must be scalar
if max(size(y0))>2
error('y0 must be scalar.');
end
end
if nargin<8 | isempty(z0)==1
z0=0.1;
else
% z0 must be scalar
if max(size(z0))>2
error('z0 must be scalar.');
end
end
if nargin<9 | isempty(h)==1
h=0.01;
else
% h must be scalar
if max(size(h))>2
error('h must be scalar.');
end
% h must be positive
if h<0
error('h must be positive.');
end
end
% Initialize
y(1,:)=[x0 y0 z0];
% Simulate
for i=2:n
ydot(1)=s*(y(i-1,2)-y(i-1,1));
ydot(2)=r*y(i-1,1)-y(i-1,2)-y(i-1,1)*y(i-1,3);
ydot(3)=y(i-1,1)*y(i-1,2)-b*y(i-1,3);
y(i,:)=y(i-1,:) h*ydot;
end
% Separate the solutions
x=y(:,1);
z=y(:,3);
y=y(:,2);
% Add normal white noise
x=x randn(n,1)*level*std(x);
y=y randn(n,1)*level*std(y);
z=z randn(n,1)*level*std(z);
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论