Find the nonlinear equation

2 views (last 30 days)
Shaghayegh Shahhosseini
Shaghayegh Shahhosseini on 6 Dec 2021
I have the x y z values and could plot the nonlinear graph like attached but do not know how to find its equation,
can anyone help?

Answers (1)

Abolfazl Chaman Motlagh
Abolfazl Chaman Motlagh on 8 Dec 2021
If you have a form of equations they should obey you should try fit that function on your data. you can use eather fit functions or optimization functions. if not your problem is kinda interpolation or again fitting but with a set of test functions.(like fourier or taylor expansion) (or like piece-wise interpolation methods).
As i can get from your plot, you are searching for a parametric Curve not a surface on 3 dimensional space. an equation like F(x,y,z)=0 yield to a surface. a parametric curve is like:
but by removing one of condition (if at least one of functions is invertible) you can find other 2 variables as funtions of third one. for example :
so the task is find and . a simple solution in matlab is using fit function. i give an example here:
alpha = 0:0.01:1;
X = cos(2*pi*alpha);
Y = sin(2*pi*alpha);
Z = 5*alpha;
so here we can use just Z as a parameter (cause the Z values are unique and it can use as a independent variable, in other word is invertible in all domain)
fitobject_1 = fit(Z',X','cubicinterp');
fitobject_2 = fit(Z',Y','cubicinterp');
so you can use the function returns from fit as your solutions.
for evaluating a value use feval function on fit outputs.
(because in this example of mine the plot is very accurate i shift the fitted curve a little in z direction to both become visible)
figure;plot3(X,Y,Z,'LineWidth',2);hold on;plot3(X_,Y_,Z+0.1,'LineWidth',2);legend('Data','Fitted')

Community Treasure Hunt

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

Start Hunting!

Translated by