blob: 2c5f799b11319368da74c5d262dd86c604ac8ac8 (
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
|
//Clearing console
clc
clear
x = poly(0,"x")
y = poly(0,"y")
//Intializing Variables
r = 1
s = 0.5
//Node 2: (3*m + b=1)
//Node 3: (2.5*m + b=2)
//constructing matrices for solving b and m
k = [3 1;2.5 1]
f = [1;2]
//Solving for b and m
u(1:2,1)=linsolve(k,-f)
//Calculating x and y for (r, s) = (1, 0.5)
X = (1 - r )*(1 - s)/4 + (1 + r )*(1 - s)*(3)/4 + (1 + r )*(1 + s)*(2.5)/4 + (1 - r )*(1 + s)*(1.25)/4
Y =(1 - r )*(1 - s)/4 + (1 + r )*(1 - s)/4 + (1 + r )*(1 + s)*(2)/4 + (1 - r )*(1 + s)*(1.75)/4
//Printing Results
printf('\nResults\n')
printf('\nelement edge 2-3 is described by y=')
disp(u(1,1)*x + u(2,1))
printf('\nFor (r, s) = (1, 0.5) , we obtain')
printf('\n x=%f y=%f',X,Y)
|