필터 지우기
필터 지우기

how to create a polynomial interpolation of two variables

조회 수: 4 (최근 30일)
merwan behar
merwan behar 2023년 1월 16일
댓글: John D'Errico 2023년 1월 18일
how to create a polynomial interpolation of two variables with following data:
x=0:0.5:2;
y=0:0.1:0.4;
z=[13.2689 14.8741 16.4243 17.9337 19.4118]

답변 (1개)

John D'Errico
John D'Errico 2023년 1월 17일
Sorry, but this is a common mistake made by people.
You really have only ONE variable there, since x and y are linearly related. Therefore you cannot perform a TWO dimensional interpolation.
x=0:0.5:2;
y=0:0.1:0.4;
plot(x,y,'o')
You CAN perform an interpolation of z as a function of x, or z as a function of y. They will be identical mathematically, due to the linear relationship between x and y.
  댓글 수: 5
merwan behar
merwan behar 2023년 1월 18일
I want to draw a two-dimensional graph, I can't do it with the surface function .
as the following figure
John D'Errico
John D'Errico 2023년 1월 18일
You don't have two dimensions of information content in your data. Wanting to do something is nice. But wanting the mathemtically impossible is not enough.
As I showed, your data lives only perfectly along a straight line. And that makes it impossible.
You need to get data that provides information in TWO dimensions. Not just one. Again, here is your data in the (x,y) plane:
x=0:0.5:2;
y=0:0.1:0.4;
plot(x,y,'o-')
Do you see that the data lives along a straight line?
Instead, you want data that looks like this:
xgood = [0 1 2 0 1 2 0 1 2];
ygood = [0 0 0 .2 .2 .2 .4 .4 .4];
hold on
plot(xgood,ygood,'rs')
The data in red is data that explores the entire domain. And it allows you to draw the surface you want to see. The data you have is sadly, completely useless in this respect.
You need to understand the difference.

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

카테고리

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

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by