大概看了一下程序,感觉你应该是想这样做,试着帮你改了一下。如果有别的问题联系我QQ:757328468
%两层的车库L1最大取2.4m,l最大取0.7,L=3.4m
L=3400;
L1=zeros(1,11);
%数据记录临时变量%%%%%%%%%%%%%%%%%%%%%%%%%
FRember=zeros(100000,1);
Rember_f=zeros(100000,1);
m_k=1;
m_i=1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
px=10^6;
%m=M/(P*L),m在两层车库的计算中是定值
m=1/3400;
B=[-m; 0;0; -m; 0; 0];
%下面这个式子的单位是N⊙m,C3star和C4star均为关于m,p,l的表达式
% f=-p^2/L*(C3star*sin(K*x)+C4star*cos(K*x))-(257*5.5*10^5)/140;
f=-1;
%x在[0,L1]上取1000份
for n1=1:3
L1=((n1-1)*2400)/10;
lset(n1)=L1/L;
l=lset(n1);
for n2=1:100
disp(n2)
x=(n2/100)*L1;
for n3=10^1:10^3
pset=n3;
p=pset;
K=p/L;
A=[0, 0, 0, 1, 1, 1; ...
0, 0,p, 0, -1, 0; ...
l, 1, 0, 0, (l^2/2-l^3/6), -1/p^2; ...
0, 0, sin(p*l), cos(p*l), 1-l, 0; ...
-p, 0, p*cos(p*l), -p*sin(p*l), -(1+p^2*(l-l^2/2)), 0; ...
1, 1, 0, 0, 1/3, 0];
sol=A\B;
C3star=sol(3);
C4star=sol(4);
f=-p^2/L*(C3star*sin(K*x)+C4star*cos(K*x))-(257*5.5*10^5)/140;
FRember(m_k,1)=f;
m_k=m_k+1;
if(f>0)
Rember_f(m_i,1)=f;
m_i=m_i+1;
end
end
end
end,