How to save genetaed figures after each loop and put all generated areas in one matrix?
2 views (last 30 days)
Show older comments
Hello everyone,
I downloaded a code from MATLAB cummnity to perform my peak deconvolution. I have muliptle txt datasets. I need to get the curve and area under the peaks after each iteration.Then I need to plot the figures and put all generated areas under each peak. in one materix. But when I ran this code, it only gves me the last iteration result. I am wondering if anyone could help me with. I have uploaded all the dataset and code in google drive. Please find them in the following link.
Thank you,
MCC
3 Comments
Answers (1)
Maxim
on 26 Mar 2020
As far as I know there is no simple way to get the fitting constants at each iteration as an output. Read the function description, maybe I've missed something.
You can artificially do it by changing the maximum number of iterations, running the script and increasing this number each time.
You can do it by changing the number after 'MaxIter', on line 44 in fitV.m.
1 Comment
Ameer Hamza
on 26 Mar 2020
Allthough I haven't seen the OP's code but if the issue is to extract values at each iteration of lsqcurvefit can you can specify OutputFcn as an option to the optimizer https://www.mathworks.com/help/optim/ug/lsqcurvefit.html#buuhcjo-options. This function is called by the optimizer after each iteration. For example, check this: https://www.mathworks.com/matlabcentral/answers/510713-is-it-possible-to-store-the-intermediate-values-of-fmincon
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!