Getting coefficients from a for loop

15 vues (au cours des 30 derniers jours)
Robbie McDermott
Robbie McDermott le 9 Déc 2017
Commenté : Robbie McDermott le 10 Déc 2017
I want to run the code below inside a for loop so that I can run through ten versions of a, i.e. a(:,:,1) to a(:,:,10).
Each of these will produce a column vector from which I want to fit an exponential decay to and then remove the coefficients from so I have a vector with ten coefficient in. Can anyone show me a easy way of doing this??
for t=1:10;
image=a(:,:,t);
image=im2double(image);
Isum=sum(image,1);
[Imax,Iloc]=max(Isum);
I=image(:,Iloc);
plot(I);
fit=fit(L,I,'exp1')
end
  2 commentaires
Walter Roberson
Walter Roberson le 9 Déc 2017
exponential fit outputs two coefficients each time, not one -- a * exp(b). Which of the two did you want to store?
Robbie McDermott
Robbie McDermott le 10 Déc 2017
Thank you for your reply, I am looking for the b coefficient.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Particle & Nuclear Physics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by