Clear Filters
Clear Filters

Non-linear formula optimization using Matlab

3 views (last 30 days)
A on 25 May 2016
Answered: John D'Errico on 25 May 2016
Hi guys,
I have a conceptual question to ask and want to know if this is possible using matlab.
I am looking for the best method of performing non-linear optimization of a 3D surface or waveform that is produced using a multi-variate formula by using actual data points from real life.
So is there a way to take a 3d function, but modify it so that is upgraded or 'optimized' based on actual 'real life' data points? So if z = x*y, but we want to modify it based on known values of x, y, and z from actual data.
Thank you

Answers (2)

Star Strider
Star Strider on 25 May 2016
It seems you want to do 3D parameter estimation. If you have a model utilising ‘x’, ‘y’, and a parameter vector, and you want to optimise the parameters of it to fit it to your ‘z’ data, you could use several functions. If you are fitting fewer than about 6 parameters, the core MATLAB function fminsearch (and a few extra lines of code) would work. If you have the Statistics Toolbox, nlinfit would work, and the Optimization Toolbox function lsqcurvefit would work. Without knowing more about your data and the function you want to fit I can’t be more specific. (The Curve Fitting Toolbox may also be able to do this, but I don’t have it so I can’t comment on it.)

John D'Errico
John D'Errico on 25 May 2016
You need to be far more clear about your goals to get meaningful help. Often this is because you don't really know what your goal is.
Optimization of a function has a clear and definite meaning in mathematics. It means you wish to locate a point that maximizes, minimizes, solves for a root, etc.
But it is not at all clear that is what you want to do. In fact, it seems pretty clear that is not your goal.
You say you have some known function, but then you want to modify it in some way from sampled data. If I had to guess, I'd wonder if you are asking to solve a parameter estimation problem, where you need to estimate the parameters of a function, perhaps
z(x,y)= a*x*y + b
This is a linear problem, so it can be solved easily using tools like my polyfitn (on the file exchange), but also the curve fitting toolbox.
If your goal is to solve for something that is essentially z=x*y where there is no data, but is adjusted to look like your data where you have some, then good luck. While that is what you sort of described, it is not a well posed problem. If you want something like that, you need to spend some time thinking about what exactly you mean.

Community Treasure Hunt

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

Start Hunting!