⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paint.m

📁 用matlab实现的结构力学中连续梁求解程序
💻 M
字号:
function paint()
h1=figure('MenuBar','none',...
    'ToolBar','none',...
    'Position',[100 350 400 300],...
    'Name','弯矩图');
h2=axes('Parent',h1,...
    'Position',[0.15 0.15 0.78 0.8],...
    'Visible','off');
l1=str2num(get(hedit16,'String'));
l2=str2num(get(hedit17,'String'));
l3=str2num(get(hedit18,'String'));
l4=str2num(get(hedit19,'String'));
l5=str2num(get(hedit20,'String'));
l=l1+l2+l3+l4+l5;
x=0:0.01:l;
y=x*0;

n1=str2num(get(hedit36,'String'));
n2=str2num(get(hedit37,'String'));
n3=str2num(get(hedit38,'String'));
n4=str2num(get(hedit39,'String'));
n5=str2num(get(hedit40,'String'));
n6=str2num(get(hedit41,'String'));
n7=str2num(get(hedit42,'String'));
n8=str2num(get(hedit43,'String'));
n9=str2num(get(hedit44,'String'));
n10=str2num(get(hedit45,'String'));

m1=str2num(get(hedit26,'String'));
m2=str2num(get(hedit27,'String'));
if get(hcheckbox11,'Value')==1&&get(hcheckbox12,'Value')==0
    v1=(-n1+n2)/2-m1*l1/4;
elseif get(hcheckbox11,'Value')==0&&get(hcheckbox12,'Value')==1
    v1=(-n1+n2)/2-m2*l1.^2/8;
elseif get(hcheckbox11,'Value')==1&&get(hcheckbox12,'Value')==1
    v1=(-n1+n2)/2-m1*l1/4-m2*l1.^2/8;
else v1=(-n1+n2)/2;
end
x1=[0 l1/2 l1];
y1=[-n1 v1 n2];
t1=polyfit(x1,y1,2);
s1=0:0.01:l1;
z1=polyval(t1,s1);
i0=0;
j0=-n1;
if j0>0
    f0=0:0.01:j0;
else f0=j0:0.01:0;
end
i1=l1;
j1=polyval(t1,i1);
if j1>0
    f1=0:0.01:j1;
else f1=j1:0.01:0;
end

m3=str2num(get(hedit28,'String'));
m4=str2num(get(hedit29,'String'));
if get(hcheckbox21,'Value')==1&&get(hcheckbox22,'Value')==0
    v2=(-n3+n4)/2-m3*l2/4;
elseif get(hcheckbox21,'Value')==0&&get(hcheckbox22,'Value')==1
    v2=(-n3+n4)/2-m4*l2.^2/8;
elseif get(hcheckbox21,'Value')==1&&get(hcheckbox22,'Value')==1
    v2=(-n3+n4)/2-m3*l2/4-m4*l2.^2/8;
else v2=(-n3+n4)/2;
end
x2=[l1 l1+l2/2 l1+l2];
y2=[-n3 v2 n4];
t2=polyfit(x2,y2,2);
s2=l1:0.01:l1+l2;
z2=polyval(t2,s2);
i2=l1+l2;
j2=polyval(t2,i2);
if j2>0
    f2=0:0.01:j2;
else f2=j2:0.01:0;
end

m5=str2num(get(hedit30,'String'));
m6=str2num(get(hedit31,'String'));
if get(hcheckbox31,'Value')==1&&get(hcheckbox32,'Value')==0
    v3=(-n5+n6)/2-m5*l3/4;
elseif get(hcheckbox31,'Value')==0&&get(hcheckbox32,'Value')==1
    v3=(-n5+n6)/2-m6*l3.^2/8;
elseif get(hcheckbox31,'Value')==1&&get(hcheckbox32,'Value')==1
    v3=(-n5+n6)/2-m5*l3/4-m6*l3.^2/8;
else v3=(-n5+n6)/2;
end
x3=[l1+l2 l1+l2+l3/2 l1+l2+l3];
y3=[-n5 v3 n6];
t3=polyfit(x3,y3,2);
s3=l1+l2:0.01:l1+l2+l3;
z3=polyval(t3,s3);
i3=l1+l2+l3;
j3=polyval(t3,i3);
if j3>0
    f3=0:0.01:j3;
else f3=j3:0.01:0;
end

m7=str2num(get(hedit32,'String'));
m8=str2num(get(hedit33,'String'));
if get(hcheckbox41,'Value')==1&&get(hcheckbox42,'Value')==0
    v4=(-n7+n8)/2-m7*l4/4;
elseif get(hcheckbox41,'Value')==0&&get(hcheckbox42,'Value')==1
    v4=(-n7+n8)/2-m8*l4.^2/8;
elseif get(hcheckbox41,'Value')==1&&get(hcheckbox42,'Value')==1
    v4=(-n7+n8)/2-m7*l4/4-m8*l4.^2/8;
else v4=(-n7+n8)/2;
end
x4=[l1+l2+l3 l1+l2+l3+l4/2 l1+l2+l3+l4];
y4=[-n7 v4 n8];
t4=polyfit(x4,y4,2);
s4=l1+l2+l3:0.01:l1+l2+l3+l4;
z4=polyval(t4,s4);
i4=l1+l2+l3+l4;
j4=polyval(t4,i4);
if j4>0
    f4=0:0.01:j4;
else f4=j4:0.01:0;
end

m9=str2num(get(hedit34,'String'));
m10=str2num(get(hedit35,'String'));
if get(hcheckbox51,'Value')==1&&get(hcheckbox52,'Value')==0
    v5=(-n9+n10)/2-m9*l5/4;
elseif get(hcheckbox51,'Value')==0&&get(hcheckbox52,'Value')==1
    v5=(-n9+n10)/2-m10*l5.^2/8;
elseif get(hcheckbox51,'Value')==1&&get(hcheckbox52,'Value')==1
    v5=(-n9+n10)/2-m9*l5/4-m10*l5.^2/8;
else v5=(-n9+n10)/2;
end
x5=[l1+l2+l3+l4 l1+l2+l3+l4+l5/2 l1+l2+l3+l4+l5];
y5=[-n9 v5 n10];
t5=polyfit(x5,y5,2);
s5=l1+l2+l3+l4:0.01:l1+l2+l3+l4+l5;
z5=polyval(t5,s5);
i5=l1+l2+l3+l4+l5;
j5=polyval(t5,i5);
if j5>0
    f5=0:0.01:j5;
else f5=j5:0.01:0;
end

plot(x,y,'r',s1,z1,'b',s2,z2,'b',s3,z3,'b',s4,z4,'b',s5,z5,'b');
hold on
plot(i0,f0,'b',i1,f1,'b',i2,f2,'b',i3,f3,'b',i4,f4,'b',i5,f5,'b');
hold off
grid;
xlabel('杆长');
ylabel('弯矩');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -