problemas con lsqcurvefit
Publicado por Virginia (2 intervenciones) el 20/01/2015 21:44:17
Hola a todos,
estoy intentando utilizar la función ''lsqcurvefit'' para hacer un ajuste no lineal, pero me da error y por mas que lo reviso no entiendo que puede pasar. Adjunto el programa que he hecho y a continuación el error que sale, por si alguien puede ayudarme. Muchas gracias por adelantado.
y=[0.000269 0.0019 0.0048 0.0083 0.014 0.0183 0.0218 0.0118 0.0070 0.0038 0.0019];
t=[-19.17 -18.47 -17.37 -16.45 -15.46 -14.52 -13.48 -12.47 -11.6 -10.65 -9.42];
plot(t,y,'bo')
F = @(x,t)(0.4/log10(exp(1)))*x(1)*10.^(-0.4*(-1.22+1)*(t-x(2)))*exp(-10.^(-0.4*(t-x(2)))); %incógnita: x=[x(1) x(2)]
x0=[1 1]; %condición inicial
x = lsqcurvefit(F,x0,t,y)
hold on
plot(t,F(x,t))
hold off
El error que sale:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==>
@(x,t)(0.4/log10(exp(1)))*x(1)*10.^(-0.4*(-1.22+1)*(t-x(2)))*exp(-10.^(-0.4*(t-x(2))))
Error in ==> lsqcurvefit at 209
initVals.F = feval(funfcn_x_xdata{3},xCurrent,XDATA,varargin{:});
Error in ==> adjustment at 9
x = lsqcurvefit(F,x0,t,y)
Caused by:
Failure in initial user-supplied objective function evaluation. LSQCURVEFIT cannot continue.
estoy intentando utilizar la función ''lsqcurvefit'' para hacer un ajuste no lineal, pero me da error y por mas que lo reviso no entiendo que puede pasar. Adjunto el programa que he hecho y a continuación el error que sale, por si alguien puede ayudarme. Muchas gracias por adelantado.
y=[0.000269 0.0019 0.0048 0.0083 0.014 0.0183 0.0218 0.0118 0.0070 0.0038 0.0019];
t=[-19.17 -18.47 -17.37 -16.45 -15.46 -14.52 -13.48 -12.47 -11.6 -10.65 -9.42];
plot(t,y,'bo')
F = @(x,t)(0.4/log10(exp(1)))*x(1)*10.^(-0.4*(-1.22+1)*(t-x(2)))*exp(-10.^(-0.4*(t-x(2)))); %incógnita: x=[x(1) x(2)]
x0=[1 1]; %condición inicial
x = lsqcurvefit(F,x0,t,y)
hold on
plot(t,F(x,t))
hold off
El error que sale:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==>
@(x,t)(0.4/log10(exp(1)))*x(1)*10.^(-0.4*(-1.22+1)*(t-x(2)))*exp(-10.^(-0.4*(t-x(2))))
Error in ==> lsqcurvefit at 209
initVals.F = feval(funfcn_x_xdata{3},xCurrent,XDATA,varargin{:});
Error in ==> adjustment at 9
x = lsqcurvefit(F,x0,t,y)
Caused by:
Failure in initial user-supplied objective function evaluation. LSQCURVEFIT cannot continue.
Valora esta pregunta


0