How to interpolate in between known data points..?

15 ビュー (過去 30 日間)
JAGADEESH KUMAR M
JAGADEESH KUMAR M 2018 年 6 月 27 日
編集済み: Stephen23 2018 年 6 月 27 日
I have data at starting and the ending and I want to interpolate the data in between. Can any one suggest me best method to do it. for example:
Y = peaks(100);
y = Y(50,:);
y(40:50) = 0;
figure();subplot(1,2,1);plot(x,y,'b');title('available data');ylabel('y');
hold on; plot(x,Y(50,:),'b.');legend('available','expected');
subplot(1,2,2);plot(x,Y(50,:),'b');ylabel('Y');title('expected');
dots in first plot of the above (or second plot) is expected and thick line indicates the available data. I want to interpolate in between using the data x<40 and x>50.

採用された回答

Stephen23
Stephen23 2018 年 6 月 27 日
編集済み: Stephen23 2018 年 6 月 27 日
% Data:
Y = peaks(100);
x = 1:size(Y,2);
y = Y(50,:);
y(40:50) = 0;
% Interpolate zeros:
idx = y~=0;
yn = interp1(x(idx),y(idx),x,'spline');
plot(x,y,x,yn)
legend('missing','interpolated')
Giving:

その他の回答 (1 件)

KSSV
KSSV 2018 年 6 月 27 日
Read about interp1

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by