nlinfit results output from for loop

1 visualizzazione (ultimi 30 giorni)
Avigdor
Avigdor il 14 Giu 2014
Commentato: Image Analyst il 14 Giu 2014
Hi,
I'm having an indexing problem. I have placed a for loop around an nlinfit statement to perform regression for a data matrix. The data matrix is a 16 by 5 matrix, where the fit is over the 16 rows, performed for each column. How can I index properly to output each set of fit parameters, a total of five fits with three parameters each, in a final output matrix. The output matrix would be a 3 by 5 matrix.
Any tips?
Avi

Risposte (1)

Image Analyst
Image Analyst il 14 Giu 2014
[rows, columns] = size(data);
for col = 1 : columns
% Extract this column only.
thisColumn = data(:, col);
% Do the fitting.
nlfit(..thisColumn..........
end
  2 Commenti
Image Analyst
Image Analyst il 14 Giu 2014
"Answer" moved here since it's a reply to me:
Yes, found a similar solution moments ago… Thanks!
Image Analyst
Image Analyst il 14 Giu 2014
You're welcome. Can you go ahead and mark it "Accepted" so others will know they don't need to help you any more by opening this and responding?

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by