Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Problem 6
- Loading branch information
nin13001
committed
Nov 18, 2017
1 parent
af13436
commit 508aeaf
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fun = @(x) (1/6).*(x).^3+(1/2).*(x).^2+(x); | ||
q = integral(fun,2,3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
%1-Pt | ||
x = [0]; | ||
a = [2]; | ||
b = 2; | ||
c = 3; | ||
tildec = (c-b)/2*a; | ||
tildex = (c-b)/2*x + (c+b)/2; | ||
f = (1/6).*(tildex).^3+(1/2).*(tildex).^2+(tildex); | ||
value1 = sum(tildec.*f) | ||
|
||
%2-Pt | ||
x = [-0.57735,0.57735]; | ||
a = [1,1]; | ||
b = 2; | ||
c = 3; | ||
tildec = (c-b)/2*a; | ||
tildex = (c-b)/2*x + (c+b)/2; | ||
f = (1/6).*(tildex).^3+(1/2).*(tildex).^2+(tildex); | ||
value2 = sum(tildec.*f) | ||
|
||
|
||
%3-Pt | ||
x = [-0.77459666,0,0.77459666]; | ||
a = [0.5555555,0.88888888,0.55555555]; | ||
b = 2; | ||
c = 3; | ||
tildec = (c-b)/2*a; | ||
tildex = (c-b)/2*x + (c+b)/2; | ||
f = (1/6).*(tildex).^3+(1/2).*(tildex).^2+(tildex); | ||
value3 = sum(tildec.*f) |