How can I interpolate this row?

Hi Everyone, I would like to get your help to interpolate this vector: x=[2 NaN NaN 5 NaN NaN] to fill the messing values
Thanks in advance
Riyadh

2 Kommentare

Rik
Rik am 7 Nov. 2017
Do you have an estimation of the function that should be used? Because if it is anything other than linear, you have too few values.
Riyadh Muttaleb
Riyadh Muttaleb am 7 Nov. 2017
Bearbeitet: Riyadh Muttaleb am 7 Nov. 2017
No. Do you know how can I interpolate one like this[2 3 4 5 NaN NaN]?

Antworten (1)

M
M am 7 Nov. 2017
Bearbeitet: M am 7 Nov. 2017

0 Stimmen

Check if the fillmissing function does what you want. https://mathworks.com/help/matlab/ref/fillmissing.html

3 Kommentare

Riyadh Muttaleb
Riyadh Muttaleb am 7 Nov. 2017
Thank you for your response, I tried to use "fillmissing" but I got this sentence "Undefined function or variable 'fillmissing'" It is weird, since I am using matlab 2015!
M
M am 7 Nov. 2017
Bearbeitet: M am 7 Nov. 2017
You don't have the associated license.
try something like :
nanx = isnan(x);
t = 1:numel(x);
x(nanx) = interp1(t(~nanx), x(~nanx), t(nanx));
Riyadh Muttaleb
Riyadh Muttaleb am 7 Nov. 2017
Thank you.. I already did and I had gotten the answer

Diese Frage ist geschlossen.

Tags

Gefragt:

am 7 Nov. 2017

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by