Matlab程序 哪里错了,它提示的看不懂
x0=[41,49,61,78,96,104];n=length(x0);x1=cumsum(x0);a_x0=diff(x0)';z=0.5*(x1(2:end)+x1...
x0=[41,49,61,78,96,104];
n=length(x0);
x1=cumsum(x0);
a_x0=diff(x0)';
z=0.5*(x1(2:end)+x1(1:end-1))';
B=[-x0(2:end)',-z,ones(n-1,1)];
Y=a_x0;
u=B\Y; %小二乘法拟合参数
%下面求微分方程边值问题的解
x=dsolve('D2x+a1*Dx+a2*x=b','x(0)=c1,x(5)=c2');
x=subs(x,{'a1','a2','b','c1','c2'},{u(1),u(2),u(3),x1(1),x1(6)});
yuce=subs(x,'t',0:n-1);
digits(6),x=vpa(x);
x0_hat=[yuce(1),diff(yuce)];
x0_hat=round(x0_hat); %四舍五入取整数
epsilon=x0-x0_hat; %求残差
delta=abs(epsilon./x0); %求相对误差
错误使用 symengine (line 58)
Array sizes must match.
出错 sym/privBinaryOp (line 835)
Csym = mupadmex(op,args{1}.s, args{2}.s,
varargin{:});
出错 - (line 7)
X = privBinaryOp(A, B, 'symobj::zip', '_subtract'); 展开
n=length(x0);
x1=cumsum(x0);
a_x0=diff(x0)';
z=0.5*(x1(2:end)+x1(1:end-1))';
B=[-x0(2:end)',-z,ones(n-1,1)];
Y=a_x0;
u=B\Y; %小二乘法拟合参数
%下面求微分方程边值问题的解
x=dsolve('D2x+a1*Dx+a2*x=b','x(0)=c1,x(5)=c2');
x=subs(x,{'a1','a2','b','c1','c2'},{u(1),u(2),u(3),x1(1),x1(6)});
yuce=subs(x,'t',0:n-1);
digits(6),x=vpa(x);
x0_hat=[yuce(1),diff(yuce)];
x0_hat=round(x0_hat); %四舍五入取整数
epsilon=x0-x0_hat; %求残差
delta=abs(epsilon./x0); %求相对误差
错误使用 symengine (line 58)
Array sizes must match.
出错 sym/privBinaryOp (line 835)
Csym = mupadmex(op,args{1}.s, args{2}.s,
varargin{:});
出错 - (line 7)
X = privBinaryOp(A, B, 'symobj::zip', '_subtract'); 展开
展开全部
可这样改:
x0=[41,49,61,78,96,104];
n=length(x0);
x1=cumsum(x0);
a_x0=diff(x0)';
z=0.5*(x1(2:end)+x1(1:end-1))';
B=[-x0(2:end)',-z,ones(n-1,1)];
Y=a_x0;
u=B\Y; %小二乘法拟合参数
%下面求微分方程边值问题的解
x=dsolve('D2x+a1*Dx+a2*x=b','x(0)=c1,x(5)=c2');
x=subs(x,{'a1','a2','b','c1','c2'},{u(1),u(2),u(3),x1(1),x1(6)});
yuce=subs(x,'t',0:n-1);
digits(6),x=vpa(x);
x0_hat=diff(yuce);
%x0_hat=[yuce(1),diff(yuce)];
x0_hat=round(x0_hat); %四舍五入取整数
epsilon=x0-double(x0_hat); %求残差
delta=abs(epsilon./x0); %求相对误差
x0=[41,49,61,78,96,104];
n=length(x0);
x1=cumsum(x0);
a_x0=diff(x0)';
z=0.5*(x1(2:end)+x1(1:end-1))';
B=[-x0(2:end)',-z,ones(n-1,1)];
Y=a_x0;
u=B\Y; %小二乘法拟合参数
%下面求微分方程边值问题的解
x=dsolve('D2x+a1*Dx+a2*x=b','x(0)=c1,x(5)=c2');
x=subs(x,{'a1','a2','b','c1','c2'},{u(1),u(2),u(3),x1(1),x1(6)});
yuce=subs(x,'t',0:n-1);
digits(6),x=vpa(x);
x0_hat=diff(yuce);
%x0_hat=[yuce(1),diff(yuce)];
x0_hat=round(x0_hat); %四舍五入取整数
epsilon=x0-double(x0_hat); %求残差
delta=abs(epsilon./x0); %求相对误差
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询