function rama()
Edof=[1 1 2 3 4 5 6; 
    2 4 5 6 7 8 9; 
    3 7 8 9 10 11 12];

K=zeros(12);
F=zeros(12,1);
F(4)=100;
F(9)=50;
E=2e7;
I=1e-4;
A=0.03;
ep=[E,A,I];

Coord=[0 0; 
    1.5 2; 
    3 4;
    6 0];

Dof=[1 2 3; 
    4 5 6; 
    7 8 9 ;
    10 11 12];
Eq=10*3/5*[4/5,-3/5];
[Ex,Ey]=coordxtr(Edof,Coord,Dof,2)
Ke1=beam2e(Ex(1,:),Ey(1,:),ep);
Ke2=beam2e(Ex(2,:),Ey(2,:),ep);
[Ke3,Fe3]=beam2e(Ex(3,:),Ey(3,:),ep,Eq);

K=assem(Edof(1,:),K,Ke1);
K=assem(Edof(2,:),K,Ke2);
[K,F]=assem(Edof(3,:),K,Ke3,F,Fe3);

bc=[ 1 0; 2 0 ; 3 0 ; 10 0; 11 0 ; 12 0];

[Q,R]=solveq(K,F,bc)

Qe=extract(Edof,Q);

f1=beam2s(Ex(1,:),Ey(1,:),ep,Qe(1,:),[0,0],7)
f2=beam2s(Ex(2,:),Ey(2,:),ep,Qe(2,:),[0,0],7)
f3=beam2s(Ex(3,:),Ey(3,:),ep,Qe(3,:),Eq,21)

figure(1)
eldraw2(Ex,Ey,[1,2,2]);
eldisp2(Ex,Ey,Qe,[1 4 1]);
axis([-1 7 -1 5]);
title('przemieszczenia')

plotpar=[2 1];
figure(2)
scal=scalfact2(Ex(3,:),Ey(3,:),f3(:,1),0.35);
eldia2(Ex(1,:),Ey(1,:),f1(:,1),plotpar,scal);
eldia2(Ex(2,:),Ey(2,:),f2(:,1),plotpar,scal);
eldia2(Ex(3,:),Ey(3,:),f3(:,1),plotpar,scal);
axis([-1 7 -1 5]);
title('sily podluzne')

figure(3)
scal=scalfact2(Ex(1,:),Ey(1,:),f1(:,2),0.35);
eldia2(Ex(1,:),Ey(1,:),f1(:,2),plotpar,scal);
eldia2(Ex(2,:),Ey(2,:),f2(:,2),plotpar,scal);
eldia2(Ex(3,:),Ey(3,:),f3(:,2),plotpar,scal);
axis([-1 7 -1 5]);
title('sily poprzeczne')

figure(4)
scal=scalfact2(Ex(1,:),Ey(1,:),f3(:,3),0.35);
eldia2(Ex(1,:),Ey(1,:),f1(:,3),plotpar,scal);
eldia2(Ex(2,:),Ey(2,:),f2(:,3),plotpar,scal);
eldia2(Ex(3,:),Ey(3,:),f3(:,3),plotpar,scal);
axis([-1 7 -1 5]);
title('momenty')
