|
Hi there,
The code below worked fine until I chnaged the import of the text file.
The new file yield2 is esentially similar although slightly more columns.
However as the number of columns or indeed rows is not hard coded I don't see this should cause a problem?
How after changing the code to import yield2.txt the follwoing error message appeared
??? Subscripted assigment dimension mismatch?
Error in ==> curvefit at 11
xdata(i,:)=data(1:);
Please advise
%% datafitting parameters
clc
close all
clear screen
%data= dlmread('yield.txt','\t');
data= dlmread('yield2.txt','\t');
ydata=data(2:end,:);
%ydata=data(2,:);
k=size(ydata);
for i=1:k(1)
xdata(i,:)=data(1,:);
end
%x=eyes(2:end,:);oi
%xdata=data(1,:);
xdata2=[2 5 10 30];
ydata2=[4.3 4.94 5.52 5.95];
xdata3=data(1,:);
ydata3=data(2,:);
%c0 = [1.0 2 3 4];% starting values
c0 = [1 1 1 1 1 1];
%c0 = [1.0 1 1];
lbn = []; % lower bound
ubn = []; % upper bound
options = optimset('LargeScale','on','MaxFunEvals',100000,'TolFun',1e-5,'MaxIter',10000 );
% datafitting
[cn,error]=lsqcurvefit(@PrimePerm,c0,xdata,ydata,lbn,ubn,options);
|