How can I write a script that plots the data and then interpolates it with a smooth curve (plot
the curve too). also find and plot the value of y for t=4.
t 0 0.5 1.0 6.0 7.0 9.0
y 0 1.6 2.0 2.0 1.5 0

 채택된 답변

madhan ravi
madhan ravi 2018년 12월 30일
편집: madhan ravi 2018년 12월 30일

2 개 추천

t = [0 0.5 1.0 6.0 7.0 9.0];
y = [0 1.6 2.0 2.0 1.5 0];
y_when_t_is_4 = interp1(t,y,4);
xx=linspace(t(1),t(end),1000);
yy=interp1(t,y,xx,'spline'); % use whatever method suits you the best
plot(t,y,'o',xx,yy)

댓글 수: 3

Image Analyst
Image Analyst 2018년 12월 30일
And it will look like this:
0000 Screenshot.png
madhan ravi
madhan ravi 2018년 12월 30일
Thank you sir Image Analyst :)
Utku Palakci
Utku Palakci 2018년 12월 30일
Thanks for your all help

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

태그

질문:

2018년 12월 30일

댓글:

2018년 12월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by