time series interpolation of irregular data

1 view (last 30 days)
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

Accepted Answer

KSSV
KSSV on 23 Jun 2021
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)) ;

More Answers (1)

Sargondjani
Sargondjani on 23 Jun 2021
You can use "griddedInterpolant". I would use 'pchip' as method.

Categories

Find more on Interpolation in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!