Using fit inside a loop
4 views (last 30 days)
I have constructed a for loop in which I save a set of XY positions and a measured windspeed field as:
filenameX = sprintf('Xdata_%d_of_50', i);
Now, I am looking for a way of also saving a fit of said data using fit. I am using the example code
sf = fit([x, y],z,'poly23')
sf = fit([positions(:,1), positions(:,2)],windX_in_the_node_vector,'poly23')
however, if I try to put it inside of the for loop simply writing sf(i) =... I get an error. Can I also automate this use of fit or do I need to do this 50 times by hand?