How to fit a function with two or more dependant variables (outputs)?

15 views (last 30 days)
I have a complex matlab function that takes x -> (y1,y2) based on several passed parameters. I would like to use curve fitting to find the optimal parameters that fit the function to data. Are there any such tools in MATLAB to accomplish this? nlinfit and the others seem to only want to work with a single independant variable column vector and a single dependant variable column vector (i.e. x -> y).
Torsten on 2 Jun 2022
Edited: Torsten on 2 Jun 2022
What is the difference between an array and a vector ?
If you enter X and Y as independent and dependent vectors, all should work out fine.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 2 Jun 2022
lsqcurvefit does not care about the dimensionality of the independent or dependant variables.

Sign in to comment.

More Answers (1)

M Mirrashid
M Mirrashid on 5 Jun 2022

Community Treasure Hunt

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

Start Hunting!

Translated by