matlab画图时,出现了matrix must be square!改了点乘和点除,还是出错!?

2024-12-17 09:53:50
推荐回答(1个)
回答1:

Pre的括号去除,平方要用“.^2”
a=1;
t=0.2;
E=0.5;
% k=0.1;
belt=0.6;
Cm=0.8;
Ec=0.4;
Pc=0.2;
Pre=0:a/E;
Rm=(8*t*belt*(a-Pre.*E)).^2./(Pre.^2-8*t*belt).^2-Cm-t*belt*(E-(a*Pre-8*t*E*belt)./(Pre.^2-8*t*belt)).^2+Pc*Ec;
Rmo=(8*t*(a-Pre*E)).^2./(Pre.^2-8*t).^2-Cm-t*(E-(a*Pre-8*t*E)./(Pre.^2-8*t)).^2+Pc*Ec;
plot(Pre,Rm,'k*',Pre,Rmo,'k-');