发布网友 发布时间:2022-04-25 10:59
共2个回答
热心网友 时间:2024-11-19 19:51
x0为初始解向量;xdata,ydata为满足关系ydata=F(x, xdata)的数据;热心网友 时间:2024-11-19 19:57
就是误差的代数和,比如如下程序,
clear
ydata = [0.42 0.45 0.47 0.51 0.55 0.61 0.67 0.72 ];
xdata = [1163.4 1177.6 1191.9 1206.2 1220.51234.8 1249.1 1263.4 ]
xdata = xdata/1000;
plot(xdata, ydata,'-rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',10)
hold on
xlabel('亮温')
ylabel('发射率')
legend('Kriging.','IDW.','SFM.','Location','north')
hold on
x0 = [1,1,1,1];
[x,resnorm] =lsqcurvefit(@myfun,x0,xdata,ydata) %回车后;
yy=myfun(x,xdata);
result=[ydata'yy' (yy-ydata)'] %依次显示的原值、拟合值和误差;
plot(xdata, yy, '-*','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','y',...
'MarkerSize',10)
其最后结果为:
x = 174.6944 -417.2740 330.2620 -86.2558
resnorm = 1.6039e-004
拟合的结果:result =
0.4200 0.4235 0.0035
0.4500 0.4425 -0.0075
0.4700 0.4720 0.0020
0.5100 0.5104 0.0004
0.5500 0.5563 0.0063
0.6100 0.6080 -0.0020
0.6700 0.6642 -0.0058
0.7200 0.7232 0.0032
大家想试验这个程序需要在myfun(,)定义三次多项式拟合方程才行!下面是三次多项式拟合函数方程
function [F] =MyFun(x,xdata)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here%
F = x(1)+x(2)*xdata.^1 + x(3)*xdata.^2 + x(4)*xdata.^3; % 三次多项式拟合方程
end
热心网友 时间:2024-11-19 19:59
就是误差的代数和,比如如下程序,
clear
ydata = [0.42 0.45 0.47 0.51 0.55 0.61 0.67 0.72 ];
xdata = [1163.4 1177.6 1191.9 1206.2 1220.51234.8 1249.1 1263.4 ]
xdata = xdata/1000;
plot(xdata, ydata,'-rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',10)
hold on
xlabel('亮温')
ylabel('发射率')
legend('Kriging.','IDW.','SFM.','Location','north')
hold on
x0 = [1,1,1,1];
[x,resnorm] =lsqcurvefit(@myfun,x0,xdata,ydata) %回车后;
yy=myfun(x,xdata);
result=[ydata'yy' (yy-ydata)'] %依次显示的原值、拟合值和误差;
plot(xdata, yy, '-*','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','y',...
'MarkerSize',10)
其最后结果为:
x = 174.6944 -417.2740 330.2620 -86.2558
resnorm = 1.6039e-004
拟合的结果:result =
0.4200 0.4235 0.0035
0.4500 0.4425 -0.0075
0.4700 0.4720 0.0020
0.5100 0.5104 0.0004
0.5500 0.5563 0.0063
0.6100 0.6080 -0.0020
0.6700 0.6642 -0.0058
0.7200 0.7232 0.0032
大家想试验这个程序需要在myfun(,)定义三次多项式拟合方程才行!下面是三次多项式拟合函数方程
function [F] =MyFun(x,xdata)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here%
F = x(1)+x(2)*xdata.^1 + x(3)*xdata.^2 + x(4)*xdata.^3; % 三次多项式拟合方程
end
热心网友 时间:2024-11-19 19:51
x0为初始解向量;xdata,ydata为满足关系ydata=F(x, xdata)的数据;