Getting coefficients from a for loop

조회 수: 1 (최근 30일)
Robbie McDermott
Robbie McDermott 2017년 12월 9일
댓글: Robbie McDermott 2017년 12월 10일
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
Walter Roberson
Walter Roberson 2017년 12월 9일
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 2017년 12월 10일
Thank you for your reply, I am looking for the b coefficient.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by