필터 지우기
필터 지우기

Interpolate include NaN data.

조회 수: 3 (최근 30일)
Jeong_evolution
Jeong_evolution 2016년 11월 14일
댓글: Jeong_evolution 2016년 11월 18일
Data likes this
-----
3
NaN
NaN
7
NaN
NaN
2
NaN
NaN
19
NaN
NaN
12
-----
How interpolate NaN data?
I try interp1 fuction. But I failed.
Please help me.
  댓글 수: 1
Jan
Jan 2016년 11월 14일
Whenever you post "failed" in the forum, add your code and explain the error.

댓글을 달려면 로그인하십시오.

채택된 답변

John D'Errico
John D'Errico 2016년 11월 14일
편집: John D'Errico 2016년 11월 14일
Download inpaint_nans from the File Exchange. Although interp1 would also have been able to solve the problem too. inpaint_nans is far simpler to use for this though.
  댓글 수: 4
John D'Errico
John D'Errico 2016년 11월 14일
This is easier?
k = find(~isnan(x));
y = interp1(x(k),y(k),1:numel(x));
It is not difficult. But you cannot claim it to be simpler to use interp1 here.
Jeong_evolution
Jeong_evolution 2016년 11월 18일
I'm sorry. I didn't work hard.
Very easy.. Thanks ^^

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2016년 11월 14일
data = [3, NaN, NaN, 7, NaN, NaN, 2, NaN, NaN, 19, NaN, NaN, 12];
miss = isnan(data);
data(miss) = interp1(data(~miss), find(~miss), find(miss))
  댓글 수: 4
Jeong_evolution
Jeong_evolution 2016년 11월 18일
Mr.Simon. This is real data.
When I try this code used real data, there was an error.
But I don't know mean. You know?
Jeong_evolution
Jeong_evolution 2016년 11월 18일
Code is
------------------------------------------------------------------------------------
AA = xlsread('TMY_original_mssing_2');
data = AA(:,1:3);
miss = isnan(data);
data(miss) = interp1(data(~miss), find(~miss), find(miss));
------------------------------------------------------------------------------------

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geology에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by