Using a loop to create polyfit values for a matrix of numbers
Show older comments
Hi there, I'm trying to create a for loop to run the polyfit function for an array of numbers. The code I am currently using is:
for i=[1:11182];
x(i)=polyfit(Usable_Freq,Usable_Temp(i,:),1);
end
What I need the code to do is for each row of the Usable_Temp matrix, use the same row of Usable_freq and have polyfit run to return the values of this line.Using the above code when I run it, the following error returns: ???
In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in ==> Loop_grad at 3 x(i)=polyfit(Usable_Freq,Usable_Temp(i,:),1);
Any help to resolve this would be greatly appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Resizing and Reshaping Matrices 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!