Fit surface from Two vectors and a matrix
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have two vectors (of different length) that correspond to x and y locations in the x-y plane. I also have the corresponding matrix, z, that gives the hight above the x-y plane for all combinations of x and y( If size(x)=10,1 size(y)=7,1 then size(z)=10,7). I can plot a surface of the data by using surf(x,y,z) and it will work. What I want to do is to be able to fit this surface with a polynomial function of x and y. I am attempting to use fit([x,y],z,'fittype') however this function takes x y and z in the form of vectors only. How do I get the polynomial surface fit from the data I have?
Thanks
0 commentaires
Réponse acceptée
Matt J
le 11 Fév 2016
Modifié(e) : Matt J
le 11 Fév 2016
[X,Y]=ndgrid(1:10,1:7);
fit([X(:),Y(:)],z(:),'fittype')
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!