|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
这是从总程序中切下来的一部分程序:
function canshu
global p n M0 H0 l
n=5
p=[1.0510e+004;3.9127e+003;-2.0353e+001;-8.1851e+002;-4.2596e+002;8.6051e+002]
B=[0.5;0.5;0.5;0.5;0.5;0.5]
M0=-10000
H0=10000
l=12
S1=Sumofp1(p,n)
M=Jiedianwanju(n)
fprintf(' 节点号 p(i) S1 M(i)\n')
for i=1:n+1
fprintf('%6d %10.4e %10.4e %10.4e\n',...
i,p(i),S1(i),M(i))
end
return
%计算S1(6,1)各元素的值%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function S1=Sumofp1(p,n)
global p n
S1=zeros(n+1,1)
for i=1:n+1
for j=2:i-1
if i<=2
S1(i)=0
else
S1(i)=S1(i)+6*(i-j)*p(j)
end
end
end
end
return
%%%%%%%%%%%%%%%%%%计算M(6,1)各元素的值%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function M=Jiedianwanju(n)
global M0 H0 p l B n S1
M=zeros(n+1,1)
for i=1:n+1
if i<=2
M(i)=-M0-H0*(i-1)*l/n+l.^2*B(i)/(6*n.^2)*((3*i-4)*p(1)+p(i))
else
M(i)=-M0-H0*(i-1)*l/n+l.^2*B(i)/(6*n.^2)*((3i-4)*p(1)+S1(i)+p(i)) %在此处得到复数????????
end
end
end
return
文中标示的部分计算竟然是复数的结果!!十分不解,请高手帮忙 |
|