Borrar filtros
Borrar filtros

How to extract the equation which describe a piecewise interpolation ?

9 visualizaciones (últimos 30 días)
Hello , I have a 3d data x , y and V ( see the attached fig ) I tried to interpolate by using fitting tool in matlab and it works very well by using peicewise cubic interpolation in cftool... what i need is to reproduce this surface f(x,y) which means i need to have the equation which describe this surface ... is it possible to do it in matlab? So the function and is vital to complete my tasks.
Thanks for all of your help. Djing

Respuesta aceptada

John D'Errico
John D'Errico el 28 de Feb. de 2017
That you think you "need" the function is not relevant. There is no simple function that you can write down for that interpolant, at least not without some reams of paper. Sorry.
If your goal is simply to reproduce the surface, that can be done. Just evaluate the interpolant at many points over a grid in the (x,y) plane, as created by the function meshgrid. Then evaluate the interpolant at each point in the grid. Plot using surf or mesh as you like.
  2 comentarios
John D'Errico
John D'Errico el 28 de Feb. de 2017
Please don't add answers, just to add a comment. I've moved your answer into a comment.
"Dear John D'Errico thank you for your help and your answer ,
I think that the size of the equation depend of the lenght of the x y and V vectors , so let's say that the lenght is 200 the equation can be something like 10 pages... it's still big as equation sure but I would like to now if it is possible to do it by extracting the breaks and ceofs of the peicewise interpolation ? because in many works the authors says that they used bicubic spline interpolation to resolve such problem whithout giving details !! if not is there an another solution ?
Thanks for all of your help. Best regards. Djing"
John D'Errico
John D'Errico el 28 de Feb. de 2017
But even if someone used it to plot something, they did not need to extract the coefficients and write them down. All you have asked to do is to be able to reproduce the surface. You already have the capability to do so, simply by evaluating the interpolant at any point. You can plot it, save the fit in a .mat file to be used whenever you wish.
For example, suppose you do have 200 randomly spaced points in the plane. the interpolation tools will typically produce a triangulation over that domain. So lets see what would be generated:
xy = rand(200,2);
tri = delaunayn(xy);
size(tri)
ans =
385 3
So for 200 random points, 385 rather messy looking equations would be produced, one for each tiny triangle in that triangulation. Worse, all of those bicubic segments have dozens of coefficients, which must be written down in full precision, else you will get meaningless garbage. So every segment will be a serious mess of coefficients.
385 separate pieces would not be at all atypical for a 2-d problem.
A bit more than 10 pages, unless you use a very small font. Can you read what is written in a 2 point helvetica type face? My eyes are getting tool old to read that small of a font.
That someone else has used a bi-cubic spline fit is not at all uncommon. What they generally would never have done is write down all of those thousands of coefficients. There is simply no need to do so.
As far as there being another solution, it was you who chose to use a bicubic spline interpolant. Other common general interpolants, ranging from kriging to radial basis functions all would be equally messy to write down.
Had you used some variety of nonlinear model, things might have been easier, but you would need to provide the choice of model.
Computers make some things easy. But not all things. Some forms of information are just too messy to want to write down.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by