How to fit time series to the curve-linear trend
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/201393/untitled1_c.png)
3 comentarios
Respuestas (1)
Adam Danz
el 24 de En. de 2019
Editada: Adam Danz
el 24 de En. de 2019
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 comentarios
Adam Danz
el 25 de En. de 2019
To clarify my solution (which seems like it would work in your explanation above),
dataStandard = data - trendlineBlue;
new_data = dataStandard + trendlineRed;
Ver también
Categorías
Más información sobre Curve Fitting Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!