finding the optimal parameters

I attached 2 photos of my program. so i have numerical solution for system of differential equations, and in addition, i have data of exexperiment so i want to find the "best" parameters that will generate the closest solution. i think i need to use lsqcurvefit command but it is not working for me. any suggestions?

 Accepted Answer

Alan Weiss
Alan Weiss on 6 Aug 2018
This example is relevant.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

3 Comments

thank you very much, I've tried to write this fuction but i have errors. i would like to get your help with understanding how should i change the program please.
i attached my fuction and the main program
I do not understand what is the size of your xdata, nor what it represents. In the example I pointed you to, tspan is used as xdata, and this tspan is given by the ODE solver as the set of points used in solving the ODE. In your code, you declare tspan = [0 34], meaning tspan is a 2-element vector. You probably want to use your resulting time variable t as the set of data points.
Furthermore, in your fitlorenzfn code, you seem to assume that xdata is three-dimensional. This is where I cannot help you, because I don't understand what you are doing here. Look at the code of the example, and you see that the example fitlorenzfn takes a long vector of xdata, the set of times.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Thank you, I'm just starting use matlab so it's still confusing for me. In the beggining i wrote the fuction on the picture which solve numericly the system of differential equations. I'm not sure how to adjust the fitlorenzfn so it will find the best parameters for my data.

Sign in to comment.

More Answers (0)

Products

Release

R2018a

Community Treasure Hunt

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

Start Hunting!