How to do interpolation?

1 view (last 30 days)
Rita
Rita on 24 Apr 2017
Commented: Rita on 25 Apr 2017
I have a vector which has daily measured data for some days of a year.for example I have
A=[ 1 1
4 3
7 6
75 0
245 4
300 1
350 0
365 6]
the first column is the day of year and the second column is the measured data.I want to interpolate the second column for the other days of the year.Any suggestion?Thanks
  2 Comments
John Chilleri
John Chilleri on 24 Apr 2017
Hello,
Look into the interp1 command. I believe this will do what you wish.
Hope this helps!
Rita
Rita on 25 Apr 2017
Thanks John

Sign in to comment.

Accepted Answer

KSSV
KSSV on 25 Apr 2017
A=[ 1 1
4 3
7 6
75 0
245 4
300 1
350 0
365 6] ;
t = A(:,1) ; a = A(:,1) ;
ti = 1:365 ;
ai = interp1(t,a,ti) ;
plot(t,a,'.r') ;
hold on
plot(ti,ai,'b') ;
xlabel('days')
ylabel('value')
legend('Given data', 'interpolated');
  1 Comment
Rita
Rita on 25 Apr 2017
Thanks a lot for your comprehensive answer.

Sign in to comment.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!