blob: d5473fc7141bf53fdb061dea8577576b46514a00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
//Clearing console
clc
clear
//Intializing variables
r(1) = sqrt(3)/3
r(2) = -sqrt(3)/3
s(1) = sqrt(3)/3
s(2) = -sqrt(3)/3
W(1) = 1
W(2) = 1
I = 0
//Gaussian quadrature Integration
for j =1:2
for i =1:2
I = I + W(i)*W(j)*((r(i))^3 -1)*(s(j)-1)^2
end
end
printf('\nResults')
printf('\nIntegration of given function I =%f',-I)
|