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?

 Réponse acceptée

Alan Weiss
Alan Weiss le 6 Août 2018

0 votes

This example is relevant.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

3 commentaires

Shira Bar Dov
Shira Bar Dov le 6 Août 2018
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
Alan Weiss
Alan Weiss le 6 Août 2018
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
Shira Bar Dov
Shira Bar Dov le 7 Août 2018
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by