%  Statically Indeterminate Truss

%  Principle of Virtual Work

% Material Property and CS area

E = 1.e7;
A = 1.0

% Lengths

L2 = 10;
L1 = 10 * sqrt(2);
L3 = 20;

%  Angles

theta1 = -pi/4;
theta2 = -pi/2;
theta3 = -pi + pi/6;

%  Strain displacement relations

B1 = [cos(theta1) sin(theta1)]/L1;
B2 = [cos(theta2) sin(theta2)]/L2;
B3 = [cos(theta3) sin(theta3)]/L3;

%  Stiffness

K1 =  E*A* L1 * B1' * B1;
K2 =  E*A* L2 * B2' * B2; 
K3 =  E*A* L3 * B3' * B3;

K = K1 + K2 + K3

%  Load

P = [ 0 -1000]'

%  Solution

u = K \ P

%  Member Forces

F1 = E*A*B1*u
F2 = E*A*B2*u
F3 = E*A*B3*u