在matlab中输入时间日期,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
function
[logRS,logERS,V]=RSana(x,n,method,q)
%Syntax:
[logRS,logERS,V]=RSana(x,n,method,q)
%____________________________________________
%
% Performs R/S
analysis on a time series.
%
% logRS is the
log(R/S).
% logERS is the
Expectation of log(R/S).
% V is the V
statistic.
% x is the time
series.
% n is the vector
with the sub-periods.
% method can take
one of the following values
% 'Hurst'
for the Hurst-Mandelbrot variation.
% 'Lo' for the Lo variation.
% 'MW' for the Moody-Wu variation.
% 'Parzen' for the Parzen variation.
% q can be either
% a (non-negative) integer.
% 'auto' for the Lo's suggested value.
%
%
% References:
%
% Peters E (1991):
Chaos and Order in the Capital Markets. Willey
%
% Peters E (1996):
Fractal Market Analysis. Wiley
%
% Lo A (1991): Long
term memory in stock market prices. Econometrica
% 59: 1279-1313
%
% Moody J, Wu L
(1996): Improved estimates for Rescaled Range and Hurst
% exponents. Neural
Networks in Financial Engineering, eds. Refenes A-P
% Abu-Mustafa Y,
Moody J, Weigend A: 537-553, Word Scientific
%
% Hauser M (1997):
Semiparametric and nonparametric testing for long
% memory: A Monte
Carlo study. Empirical Economics 22: 247-271
%
%
% 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
%
% 1 Jan 2004.
if nargin<1 |
isempty(x)==1
error('You should provide a time series.');
else
% x must be a vector
if min(size(x))>1
error('Invalid time series.');
end
x=x(:);
% N is the time series length
N=length(x);
end
if nargin<2 |
isempty(n)==1
n=1;
else
% n must be either a scalar or a vector
if
min(size(n))>1
error('n must be either a scalar or a
vector.');
end
% n must be integer
if n-round(n)~=0
error('n must be integer.');
end
% n must be positive
if n<=0
error('n must be positive.');
end
end
if nargin<4 |
isempty(q)==1
q=0;
else
if q=='auto'
t=autocorr(x,1);
t=t(2);
q=((3*N/2)^(1/3))*(2*t/(1-t^2))^(2/3);
else
% q must be a scalar
if sum(size(q))>2
error('q must be scalar.');
end
% q must be integer
if q-round(q)~=0
error('q must be integer.');
end
% q must be positive
if q<0
error('q must be positive.');
end
end
end
for i=1:length(n)
% Calculate the sub-periods
a=floor(N/n(i));
% Make the sub-periods matrix
X=reshape(x(1:a*n(i)),n(i),a);
% Estimate the mean of each sub-period
ave=mean(X);
% Remove the mean from each sub-period
cumdev=X-ones(n(i),1)*ave;
% Estimate the cumulative deviation from
the mean
cumdev=cumsum(cumdev);
% Estimate the standard deviation
switch method
case 'Hurst'
% Hurst-Mandelbrot variation
stdev=std(X);
case 'Lo'
% Lo variation
for j=1:a
sq=0;
for k=0:q
v(k+1)=sum(X(k+1:n(i),j)'*X(1:n(i)-k,j))/(n(i)-1);
if k>0
sq=sq+(1-k/(q+1))*v(k+1);
end
end
stdev(j)=sqrt(v(1)+2*sq);
end
case 'MW'
% Moody-Wu variation
for j=1:a
sq1=0;
sq2=0;
for k=0:q
v(k+1)=sum(X(k+1:n(i),j)'*X(1:n(i)-k,j))/(n(i)-1);
if k>0
sq1=sq1+(1-k/(q+1))*(n(i)-k)/n(i)/n(i);
sq2=sq2+(1-k/(q+1))*v(k+1);
end
end
stdev(j)=sqrt((1+2*sq1)*v(1)+2*sq2);
end
case 'Parzen'
% Parzen variation
if mod(q,2)~=0
error('For the "Parzen"
variation q must be dived by 2.');
end
for j=1:a
sq1=0;
sq2=0;
for k=0:q
v(k+1)=sum(X(k+1:n(i),j)'*X(1:n(i)-k,j))/(n(i)-1);
if k>0 & k<=q/2
sq1=sq1+(1-6*(k/q)^2+6*(k/q)^3)*v(k+1);
elseif k>0 & k>q/2
sq2=sq2+(1-(k/q)^3)*v(k+1);
end
end
stdev(j)=sqrt(v(1)+2*sq1+2*sq2);
end
otherwise
error('You should provide another value for "method".');
end
% Estiamte the rescaled range
rs=(max(cumdev)-min(cumdev))./stdev;
clear stdev
% Take the logarithm of the mean R/S
logRS(i,1)=log10(mean(rs));
if nargout>1
% Initial calculations fro the
log(E(R/S))
j=1:n(i)-1;
s=sqrt((n(i)-j)./j);
s=sum(s);
% The estimation of log(E(R/S))
logERS(i,1)=log10(s/sqrt(n(i)*pi/2));
% Other estimations of log(E(R/S))
%logERS(i,1)=log10((n(i)-0.5)/n(i)*s/sqrt(n(i)*pi/2));
%logERS(i,1)=log10(sqrt(n(i)*pi/2));
end
if nargout>2
% Estimate V
V(i,1)=mean(rs)/sqrt(n(i));
end
end
在matlab中输入时间日期,求助:在MATLAB里如何输入时间序列中的时间相关推荐
- java输出输入的日期_Java编写的日历,输入年月,输出这个月的日期与星期
import java.util.Scanner; public class rili { public static void main(String[] args) { for (int g = ...
- php输出英文时间日期格式,PHP使用函数gmstrftime、gmdate输出英文时间日期的安全方法(RFC 1123格式)...
PHP使用函数gmstrftime.gmdate输出英文时间日期的安全方法(RFC 1123格式) 分类:PHP_Python| 发布:佚名| 查看: | 发表时间:2014/8/6 最近项目中要为一 ...
- 计算机配置表中的内存是指什么,电脑里的性能选项中,处理器计划和内存使用所写的是什么意思...
电脑里的性能选项中,处理器计划和内存使用所写的是什么意思以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 电脑里的性能选项 ...
- matlab出现无限循环警告,[求助] 关于matlab无限循环的问题
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 各路大神,求助啊啊啊啊~ 以下是我的代码: n=0 for i=1:length(NAXLES) if CODE(i)==0 n=n+1 GVM1(n)= ...
- java中怎么通过日期算出天数_讲解对于Java中如何计算日期之间的天数知识
在Java之中用Calendar方法,我们可以容易的实现日期相关的计算: public class TestDate { public static void main(String[] args) ...
- matlab画等势线的程序,求助大牛MATLAB画三维等势面
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 首先,我先描述一下我的问题,我得到了一个三维数组,数字代表了三维空间中的势能,我想把等势面画出来,也就是把势能相同的点连接起来形成面,问下有没有大牛会的, ...
- matlab调用函数出nan,求助:Matlab的fmincon函数出现RCOND = NaN
输出为: Max Line search Directional First-order Iter F-count f(x) constraint steplengt ...
- d在java那个包中_处理日期的类在Java的哪个包中()A、java.utilB、java.ioC、java.langD...
一般曳引机三点连接举升装置的液压缸是采用(). 在税控服务器管理系统中,以下描述错误的是() "去繁求简.去粗存精",是指什么变化表现方法() 当一个实际电压源(戴维宁电路)对外开 ...
- matlab画转体_【求助】matlab生成旋转体?
CODE: clear x = 0 : pi / 10 : 2 * pi; % x范围 y = 2 + cos( x ); % y = f( x ); [ X, Y, Z ] = cylind ...
最新文章
- Dubbo 3.0 预览版解读,6到飞起~
- sevlet表单处理无法相应问题及web.xml配置.
- 通常情况下的中国剩余定理
- 决策引擎的内核及基于Drools开源引擎讲解
- [Istioc]Istio部署sock-shop时rabbitmq出现CrashLoopBackOff
- 原创 | 职场二十年(一)电话风波
- Docker与.Net项目类型
- java抽奖代码_纯java代码实现抽奖系统
- android sftp 编辑器,VSCode编辑器插件之SFTP工具
- 今天看到CSDN某博客提到的linux在线音乐播放器,移动的咪咕音乐不错,推荐一下
- RK3566上调试JL2101 1000M PHY
- 小米android的手机根目录,手机网站根目录在哪?
- 新手小白怎么学抖音运营?抖音运营5大技巧
- java 异常恢复_Java学习之异常处理
- JavaScript 剪贴板
- 主机和服务器之间有何区别?
- 无线覆盖商场微信吸粉解决方案
- Stairway to SQL Server Security Level 3: Principals and Securables - SQLServerCentral
- 用DESKTOP.INI和folder.htt来自动运行程序
- 爬虫正则匹配固定长度的数字
热门文章
- while do done循环语句
- 火绒安全软件(安全防护软件)官方中文版V5.0.59.0 | 火绒安全软件好用吗
- 学习型通用红外遥控设备(二)
- 你也不知道吧?VIVO手机为什么很少出现质量问题?答案意想不到
- FFmpeg开发(八)——Qt视频播放器之多线程的使用(参考了暴风影音、迅雷影音)
- google chrom 开发工具选项快捷操作
- [Reprint]C++函数前和函数后加const修饰符区别
- 机器人门禁控制盒怎么接线方法_门禁系统安装步骤及接线图
- 计算机专业的简报,计算机文化节简报
- 注册资本认缴的期限是多久