Matlab Lsqucurvefit 函数 “Function value and YDATA sizes are n
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/13 04:20:14
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('原始数据','拟合数据')
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('原始数据','拟合数据')
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
点太少了
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
点太少了
Matlab Lsqucurvefit 函数 “Function value and YDATA sizes are n
请问MATLAB怎样调用function函数? 如:
matlab中function 函数怎么用?
matlab function
matlab定义函数function[r] = MCT(a1,a2);[m,n]=size(a1);clv1=zeros
matlab:Error:Function definitions are not permitted in this
matlab 出现Function definitions are not permitted at the promp
如何在matlab中运行一下function函数
matlab中function定义函数,出现自变量未定义错误,是怎么回事?
求大神帮忙用matlab定义一个函数function
MATLAB中函数function是怎么用的?
matlab中set(head1,'xdata',x1,'ydata',y1)什么意思?