如何生成时间序列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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/441667.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【CF#192 A】Funky Numbers (二分,查找,二元组)

题干&#xff1a; As you very well know, this years funkiest numbers are so called triangular numbers (that is, integers that are representable as , where k is some positive integer), and the coolest numbers are those that are representable as a sum of two…

matlab考试试题,matlab-考试试题-

matlab-考试试题- MATLAB 考试试题 (1) 产生一个1x10的随机矩阵&#xff0c;大小位于( -5 5)&#xff0c;并且按照从大到小的顺序排列好&#xff01;(注&#xff1a;要程序和运行结果的截屏)答案&#xff1a;a10*rand(1,10)-5;bsort(a, descend )1.请产生一个100*5 的矩阵&…

【HDU - 1702 】ACboy needs your help again! (栈和队列,水题模拟)

题干&#xff1a; ACboy was kidnapped!! he miss his mother very much and is very scare now.You cant image how dark the room he was put into is, so poor :(. As a smart ACMer, you want to get ACboy out of the monsters labyrinth.But when you arrive at the g…

java中jframe不存在怎么办,java – 设置JFrame背景,为什么这不起作用?

打印加载图像的宽度(如果为-1)则图像未正确加载.img Toolkit.getDefaultToolkit().createImage("red.png");System.out.println(img.getWidth(null)); // check what it prints值得阅读Loading Images Using getResource上的Java Tutorial您可以根据图像位置尝试任何…

后盾网经典原创视频教程php,《后盾网经典原创视频教程:PHP》139集

目录0_1 后盾网_IIS环境下PHP开发环境安装0 后盾网_PHP集成环境安装视频教程1 PHP视频教程 PHP基础(一)2 PHP视频教程 PHP基础(二)3 PHP视频教程 PHP基础(三)4 PHP视频教程 数据类型(一)5 PHP视频教程 数据类型(二)6 PHP视频教程 数据类型(三)7 PHP视频教程 类型转换 外部变量8…

【HDU - 1022】Train Problem I (栈模拟,水题,思维)

题干&#xff1a; As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over the world ^v^). But here comes a proble…

【HDU - 1216 】Assistance Required (模拟,类似素数打表,不是素数问题!)

题干&#xff1a; After the 1997/1998 Southwestern European Regional Contest (which was held in Ulm) a large contest party took place. The organization team invented a special mode of choosing those participants that were to assist with washing the dirty d…

任意阶魔方阵matlab程序,【精品】任意阶魔方阵算法(c语言)

n阶幻方是由前n^2(n的2次方)个自然数组成的一个n阶方阵&#xff0c;其各行、各列及两条对角线所含的n个数的和相等。洛书就是最基本的33阶魔方阵&#xff0c;做出某种最恰当的决定&#xff0c;横竖都有3个格。 0的倒数 a&#xff0d;1可以对于 n 阶单位矩阵 e 以及同阶的方阵 a…

【HDU - 1302】The Snail (模拟,水题)

题干&#xff1a; A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail has a fatigue factor of 10%, which means that on each succe…

悟空php微信复制的东西在哪找,微信收藏的文件在哪?从哪里能看到?

现在的微信有很多的小功能&#xff0c;非常的方便实用&#xff0c;但是很多功能大家都不知道&#xff0c;今天&#xff0c;开淘网小编就来教教大家怎么使用微信的“我的收藏”功能。这个功能非常实用&#xff0c;而且收藏的源文件删除的话&#xff0c;我们从收藏里还是一样能用…

python批量打印机excel,python自动化办公系列03_单个以及批量处理excel文件

先贴上数据集&#xff0c;链接&#xff1a;https://pan.baidu.com/s/1ttv7NwbRmfVPcj2iBHTAfg提取码&#xff1a;zg5v下面是关于如何计算每个销售额以及总销售的代码。import osimport pandas as pdos.chdir("C:\\Users\\yuyuk\\data science\\data analysis and descript…

【OpenJ_Bailian - 2299 】Ultra-QuickSort (归并排序 或 离散化 + 树状数组)

题干&#xff1a; In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. For the input sequ…

redis阻塞队列 java,Redis阻塞/非阻塞队列

非阻塞队列RPUSH key value [value ...]RPOP keyLPUSH key value [value ...]LPOP keyR/LPUSH都是后进先出操作&#xff0c;组合起来则是先进先出&#xff0c;属于非阻塞操作&#xff0c;即&#xff1a;不管有无找到指定键值都立即返回。阻塞队列RPUSH key value [value ...]BR…

*【CodeForces - 791B】Bear and Friendship Condition (图论,判断完全图,dfs乱搞或带权并查集)

题干&#xff1a; Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures). There are n members, numbered 1 through n. m pairs of members are friends.…

matlab aviobj,MATLAB AVI 视频读取处理

MATLAB AVI 视频读取处理1、用matlab读取avi视频(只能读一定压缩各式的avi 电影&#xff0c;这是因为avi视频文件的编码有很多&#xff0c;而matlab只支持部分编码格式。可见http://www.doczj.com/doc/4ae6c6222af90242a895e5fd.html/IdoIwill/article/details/2125838)aviinfo…

【CodeForces - 745B】Hongcow Solves A Puzzle (思维,乱搞,字符串)

题干&#xff1a; Hongcow likes solving puzzles. One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character X denote…

升级oracle spu,关于Oracle数据库PSU/SPU/BundlePatch的补丁号变化

思庄中心OCP脱产班1月15日开班&#xff0c;周末班于1月12日开班&#xff01;熟悉 OracleDatabase PSU、Bundle Patch 的DBA一定知道&#xff0c;一般来讲&#xff0c;这些 patch的命名规则一般是按照推出的先后顺序&#xff0c;比如在 2015年7月 推出的对 11.2.0.4 的第7个 DB …

【POJ - 2631】Roads in the North (树的直径,模板)

题干&#xff1a; Building and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such that there is only one route from a village to a village that does not pass through some other village…

h5前端有php,【前端】为什么有些网站的页面地址,没有加上html或者php或者jsp的后辍名?...

如写成http://www.例子.com/page/help的形式回答因为不需要Every HTTP URL conforms to the syntax of a generic URI. A generic URI is of the form:scheme:[//[user:[email protected]]host[:port]][/]path[?query][#fragment]via Wikipedia可见 URI 并不需要以后缀名结尾。…

【CodeForces - 803D】Magazine Ad(二分答案)

题干&#xff1a; The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters - i…