필터 지우기
필터 지우기

I am solving a quadratic interpolation on matlab and i need a bit help

조회 수: 3 (최근 30일)
Mike Garret
Mike Garret 2015년 4월 12일
댓글: Mike Garret 2015년 4월 12일
I solved this quadratic equation and i want to program it on matlab..here is the code xB=[-1.6 7.6 15.4 26.1 42.2 60.6];
yB=[20 40 60 100 200 400];
xxB=25;
n=length(xB)
if length(yB)~=n, error('x and y must be the same length');
end
D=0;
for i=1:n;
product=yB(i);
for j=1:n
if i~=j
product=product*((xxB-xB(j))/(xB(i)-xB(j)))*((xxB-xB())/(xB(i)-xB()));
end
end
D=D+product;
end
yBint= D
when i put j in the bracket for the xxB-xB().. it didnt give me the right answer. should i add a new variable e.g k ?
  댓글 수: 2
Star Strider
Star Strider 2015년 4월 12일
What do you want to do? I don’t see the parallels between the JPG image (that is difficult to read) and your code.
Mike Garret
Mike Garret 2015년 4월 12일
i was given a table of values and i want to find what what the pressure is at 25 degrees...i have attached the original question..it is problem b

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by