summaryrefslogtreecommitdiff
path: root/3588/CH2/EX2.1/EX2_1.sce
blob: a9358fcb183c8720174f75f52f53a0f914f743e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//Clearing Console
clc
clear

//Node 1 Displacement
U1=0
//Stiffness of Springs
K1=50
K2=75
//Nodal Forces
F2=75
F3=75
//varible decleration
K=[]
F=[]
U=[]

//Constructing Stiffness and Force matrices
K(1,1)=K1+K2
K(1,2)=-K2
K(2,1)=-K2
K(2,2)=K2
F(1,1)=F2
F(2,1)=F3

//Solving for Nodal Displacements U2 and U3
U=linsolve(K,-F) //K*U=F (equlibrium equation)

//Solving for Nodal force F1
F1=-50*U(1,1)

//Printing Results
printf('\nResults\n')
printf('\nNodal displacements \nU1=%fin \nU2=%fin \nU3=%fin\n',U1,U(1,1),U(2,1))
printf('\nNodal Force F1=%flb\n',F1)