How can I change opts.StartPoint for every loop iteration for the predefined points used by the curve fitting tool?
3 views (last 30 days)
Using the curve fitting tool, I have generated the code to fit a curve using specific x and y values. However, I want to automate this process for n curves with different x and y values (with a loop). The problem is that the generated code uses those particular to my first curve as starting points.
In addition, if I leave the starting point unspecified, some estimates give an error. Is there a way to change the starting values at each iteration so that the fit on that iteration is based on the predefined starting points used by the curve fitting tool? I found a similar question in the forum (https://fr.mathworks.com/matlabcentral/answers/578068-how-can-i-change-opts-startpoint-for-a-custom-equation-at-every-loop-iteration). However, the user's initial points matrix would have to be defined manually, and I am looking for the same points that the tool generates, i.e., not to write anything manually. Is this possible?
So far my code is as follows:
ft_left= fittype( 'power2' );
for k = 1:length(Arrays_jan)
Thank you very much!
Matt J on 16 Dec 2021
Edited: Matt J on 16 Dec 2021
However, the user's initial points matrix would have to be defined manually, and I am looking for the same points that the tool generates, i.e., not to write anything manually
That is what is happening in the code that you've posted already. When you don't specify a starting point, fit() will automatically generate one.