how to create a polynomial interpolation of two variables
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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]
0 Commenti
Risposte (1)
John D'Errico
il 17 Gen 2023
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 Commenti
John D'Errico
il 18 Gen 2023
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.
Vedere anche
Categorie
Scopri di più su Interpolation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!