How to fit time series to the curve-linear trend

3 次查看(过去 30 天)
Hi,
I have fluctuating data with its own curve-linear trend(2) and by polynomial fitting I got curve-linear trend(1). How can I fit fluctuating data(2) to the curve-linear trend(1), so that data are extended by symetric reflection or any kind of data extension?
Like in the figure below.
(Thank you Adam Danz)
untitled1_c.png
  3 个评论
Zain
Zain 2019-1-24
编辑:Zain 2019-1-25
Line "1" is not covered, it is just polynomial fit trend extension of line "2" trend. I don't want to do any vertical shifting, I want instead of curve (1) to have similar fluctuations as in curve (2). So I tried to multiply 1st 15000* points of data from (2) with the curve (1) and take square root
sqrt(data2(15000:-1:1).*data1)
, but than I get this (around 2 times narrower characteristic than original):
* number of points for which data set is expanded.
Adam Danz
Adam Danz 2019-1-24
Ahhh, I see. I'll continue in the answer section below.

请先登录,再进行评论。

回答(1 个)

Adam Danz
Adam Danz 2019-1-24
编辑:Adam Danz 2019-1-24
Since your data look approximately normally distributed, you can measure the standard deviation of your data and use that to produce random numbers from a normal distrubution with a mean of your trendline. Here's general instructions.
Step 1: standardize your data by subtracting the mean (which is the trend line): dataStandard = data - trendline
Step 2: calcuate the standard deviation of the standardized data: sd = std(dataStandard)
Step 3: produce random-normal noise with standard deviation calucated in step 2 and the mean will be your red trend line.: newData = normrnd(0, sd, 1, length(trendline)) + trendline.
Step 4: plot the new data: plot(trendline, newData)
  4 个评论
Zain
Zain 2019-1-25
Your last solution, I understood as:
dataStandard = data - trendline;
new_data = dataStandard + trendline; new_data = data?
To answer your question - yes, there are no y values between let's say x = 0:15000, that is why I want to symetrically reflect data from x=15001:30001 in a way x(30001:-1:150001) and fit it to follow the trend line.
Adam Danz
Adam Danz 2019-1-25
To clarify my solution (which seems like it would work in your explanation above),
dataStandard = data - trendlineBlue;
new_data = dataStandard + trendlineRed;

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by