time series interpolation of irregular data

1 次查看(过去 30 天)
here goes the data , i need data for vacant years ,
Thank you!
2012 105683
2013 1,108,498
2014 1,177,810
2015 1,271,872
2016 1,351,970
2017 1,433,392
2018 1,486,493
2019 1,546,517
2020 1,598,41
2021
2022
2023
2024
2025
2026
2027
2028 251800

采纳的回答

KSSV
KSSV 2021-6-23
data = [ 2012 105683
2013 1108498
2014 1177810
2015 1271872
2016 1351970
2017 1433392
2018 1486493
2019 1546517
2020 159841
2021 NaN
2022 NaN
2023 NaN
2024 NaN
2025 NaN
2026 NaN
2027 NaN
2028 251800 ] ;
x = data(:,1) ;
y = data(:,2) ;
idx = isnan(y) ;
y(idx) = interp1(x(~idx),y(~idx),x(idx)) ;

更多回答(1 个)

Sargondjani
Sargondjani 2021-6-23
You can use "griddedInterpolant". I would use 'pchip' as method.

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by