Matlab Lsqucurvefit 函数 “Function value and YDATA sizes are not equal”clear all;clc;x=[35000 45000 55000];y=[0.5646 0.7374 0.8743];f=@(c,x)(c(2)*x.^c(3)*sin(pi/2*c(3))/(c(1)+c(2)*x.^c(3)*cos(pi/2*c(3))));c0=[10000 10 0.01];[c,resnorm]=lsqcurve

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/08 15:22:35
Matlab Lsqucurvefit 函数 “Function value and YDATA sizes are not equal”clear all;clc;x=[35000 45000 55000];y=[0.5646 0.7374 0.8743];f=@(c,x)(c(2)*x.^c(3)*sin(pi/2*c(3))/(c(1)+c(2)*x.^c(3)*cos(pi/2*c(3))));c0=[10000 10 0.01];[c,resnorm]=lsqcurve

Matlab Lsqucurvefit 函数 “Function value and YDATA sizes are not equal”clear all;clc;x=[35000 45000 55000];y=[0.5646 0.7374 0.8743];f=@(c,x)(c(2)*x.^c(3)*sin(pi/2*c(3))/(c(1)+c(2)*x.^c(3)*cos(pi/2*c(3))));c0=[10000 10 0.01];[c,resnorm]=lsqcurve
Matlab Lsqucurvefit 函数 “Function value and YDATA sizes are not equal”
clear all;clc;
x=[35000 45000 55000];
y=[0.5646 0.7374 0.8743];
f=@(c,x)(c(2)*x.^c(3)*sin(pi/2*c(3))/(c(1)+c(2)*x.^c(3)*cos(pi/2*c(3))));
c0=[10000 10 0.01];
[c,resnorm]=lsqcurvefit(f,c0,x,y)
plot(x,y,'.-',x,f(c,x),'r:x')
legend('原始数据','拟合数据')

Matlab Lsqucurvefit 函数 “Function value and YDATA sizes are not equal”clear all;clc;x=[35000 45000 55000];y=[0.5646 0.7374 0.8743];f=@(c,x)(c(2)*x.^c(3)*sin(pi/2*c(3))/(c(1)+c(2)*x.^c(3)*cos(pi/2*c(3))));c0=[10000 10 0.01];[c,resnorm]=lsqcurve
clear all;
clc;
x=[35000 45000 55000];
y=[0.5646 0.7374 0.8743];
f=@(c,x)(c(2)*x.^c(3)*sin(pi/2*c(3))./(c(1)+c(2)*x.^c(3)*cos(pi/2*c(3))));%注意这一行要用点除
c0=[10000 10 0.01];
[c,resnorm]=lsqcurvefit(f,c0,x,y)
plot(x,y,'.-',x,f(c,x),'r:x')
legend('原始数据','拟合数据')

结果:
Optimization terminated: first-order optimality less than OPTIONS.TolFun,
and no negative/zero curvature detected in trust region model.
c =
1.0e+003 *
10.0000 0.0300 0.0104
resnorm =
0.0482

点太少了