怎么运行matlab,附录一:求GM(1,1)拟合曲线的matlab代码%compute the coefficient(a andu)------------------------n=length(x_orig);%first generate the matrix Bfor i=1:(n-1);B(i)=-(x(i)+x(i+1))/2;endB=[B' ones(n-1,1)];%then generate the matrix

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 11:25:03
怎么运行matlab,附录一:求GM(1,1)拟合曲线的matlab代码%compute the coefficient(a andu)------------------------n=length(x_orig);%first generate the matrix Bfor i=1:(n-1);B(i)=-(x(i)+x(i+1))/2;endB=[B' ones(n-1,1)];%then generate the matrix

怎么运行matlab,附录一:求GM(1,1)拟合曲线的matlab代码%compute the coefficient(a andu)------------------------n=length(x_orig);%first generate the matrix Bfor i=1:(n-1);B(i)=-(x(i)+x(i+1))/2;endB=[B' ones(n-1,1)];%then generate the matrix
怎么运行matlab,
附录一:求GM(1,1)拟合曲线的matlab代码
%compute the coefficient(a andu)------------------------
n=length(x_orig);
%first generate the matrix B
for i=1:(n-1);
B(i)=-(x(i)+x(i+1))/2;
end
B=[B' ones(n-1,1)];
%then generate the matrix Y
for i=1:(n-1);
y(i)=x_orig(i+1);
end
Y=y';
%get the coefficient.a=au(1) u=au(2)
au=(inv(B'*B))*(B'*Y);
%--------------------------------------------------------
%change the grey model to symbolicexpression
coef1=au(2)/au(1);
coef2=x_orig(1)-coef1;
coef3=0-au(1);
costr1=num2str(coef1);
costr2=num2str(abs(coef2));
costr3=num2str(coef3);
eq=strcat(costr1,'+',costr2,'e^',costr3,'*(t-1))');
%comparison of calculated and observedvalue
for t=1:n+predict
mcv(t)=coef1+coef2*exp(coef3*(t-1));
end
x_mcv0=diff(mcv);
x_mcve=[x_orig(1) x_mcv0];
x_mcv=diff(mcv(1:end-predict));
x_orig_n=x_orig(2:end);
x_c_error=x_orig_n-x_mcv;
x_error=mean(abs(x_c_error./x_orig_n));
if x_error>0.2
disp('model disqualification!');
elseif x_error>0.1
disp('model check out');
else
disp('model is perfect!');
end
%predicting model and plot gragh
plot(1:n,x_orig,'r*',1:n+predict,x_mcve),'k.';
p=x_mcve(end-predict+1:end);
xlabel('时间序列');
ylabel('仔猪价格');
title('GM(1,1)');
grid on
y=eq;
e=x_error;
p=x_mcve(end-predict+1:end);

怎么运行matlab,附录一:求GM(1,1)拟合曲线的matlab代码%compute the coefficient(a andu)------------------------n=length(x_orig);%first generate the matrix Bfor i=1:(n-1);B(i)=-(x(i)+x(i+1))/2;endB=[B' ones(n-1,1)];%then generate the matrix
猜你是个刚刚接触matlab的,别害怕,一步步的来,你的代码我看了下
Undefined function or variable 'x_orig'.
x_orig 还缺少这个源数据

怎么运行matlab,附录一:求GM(1,1)拟合曲线的matlab代码%compute the coefficient(a andu)------------------------n=length(x_orig);%first generate the matrix Bfor i=1:(n-1);B(i)=-(x(i)+x(i+1))/2;endB=[B' ones(n-1,1)];%then generate the matrix 有谁知道初三化学下册附录一怎么学?怎么看啊?急求答案! matlab M文件怎么运行啊, matlab的m文件怎么运行啊? matlab中4维图画法a0=(1:0.2:2);b0=2*pi*(1:0.2:2);zf=b0^2/2*1;z0=zf*(1:0.2:2);x1,x2,x3为a0,b0,z0的已知函数.[X,Y,Z]=meshgrid(x3/zf,x2/2/pi,x1/2/pi,Gm-1)surf(x3/zf,x2/2/pi,x1/2/pi,Gm-1),shading faceted;colorbar('horiz')运行结果:Error usi matlab 矩阵变形怎么吧一行长度为8的倍数的只有0或1数组,按顺序每8位组成一个数,转换出来比如说a=[1 1 1 1 1 1 1 1 ];转换以后b=[255];.a的长度可能要20w,求大神做个至少10秒只能运行出来的程序~ 我是MATLAB初学者,求MATLAB大神帮忙运行程序.源程序素材我我都有 就是不知道怎么运行起来 大神可以留下联系方式传给你,帮忙解决 用matlab怎么求? matlab怎么求素数? 怎么将这个matlab命令保存成可运行的M文件?在命令窗口这样运行是可以的 就是不会保存成可以运行的m文件 直接复制粘贴是不行的 求懂的人帮忙 用matlab求极限用MATLAB求(x^2+1)/(x^2-1)的极限,程序咋写,我写的运行出来是NaN.当x趋于1的时候求极限,运行出来是NaN matlab程序load train;%matlab本身特有% t=0:337;fs=1000;subplot(2,2,1) plot(t,train)怎么运行失败 gm 用Matlab怎么求erfc的反函数怎么用matlab求erfc-1(x) 请问Matlab怎样运行code啊?请教matlab 怎么运行code?有现成的code,就是不知道怎么样导入运行,应该输入什么指令呢? 哪位高手教我一下初三化学下册的附录一怎么学,怎么看?急寻答案! oz,lb,gm怎么分 求大神用matlab编程编一下下这个程序咧!程序要简单一点的!要有m文件,运行结果截图!