Download presentation
Presentation is loading. Please wait.
Published bySusanti Johan Modified over 5 years ago
1
Calculate the integral with; a) Trapezoidal rule b) Simpson’s rule
Sample Solutions: Calculate the integral with; a) Trapezoidal rule b) Simpson’s rule c) With computer (Visual Basic), take m=2, n=4. a) Trapezoidal rule: Divide into for equal section between 0.5 and 1. k θ f 0.5 0.6205 1 0.625 0.6411 2 0.75 0.6337 3 0.875 0.5996 4 0.5403
2
>>I=int('sqrt(tet)*cos(tet)',0.5,1);vpa(I,5) I=0.30796
Sample Solutions: b) Simpson’s rule: with Matlab >>I=int('sqrt(tet)*cos(tet)',0.5,1);vpa(I,5) I= Sub simpson_Click () 80 a = .5: b = 1: m = 2 … 85 f = Sqr(x) * Cos(x) End Sub c) With computer (Visual Basic)
3
a) Lagrange interpolation (manually) with computer
Sample Solutions: The pressure values of a fluid flowing in a pipe are given in the table for different locations . Find the pressure value for 5 m. a) Lagrange interpolation (manually) with computer Location (m) 3 8 10 Pressure (atm) 7 6.2 6 a) with Lagrange interpolation b) For computer solution, the file li.txt is arranged as follows and the code Lagr.I is run. li.txt 3 3,7 8,6.2 10,6 5
4
x=0.6786 y=0.3885 x=0.6786, y=0.3885 Sample Solutions:
How do you find x and y values, which satisfy the equations? Sub newtonrn_Click () 40 n = 2 … 41 xb(1) = 1: xb(2) = 1: xh(1) = .001: xh(2) = .001 45 '---- Error equations a(1, 1) = 2 * Cos(2 * xb(1)) - 3: a(1, 2) = 3 * xb(2) ^ 2 a(2, 1) = 2 * xb(1): a(2, 2) = 2 * xb(2) + 1 b(1) = -(Sin(2 * xb(1)) + xb(2) ^ * xb(1) + 1) b(2) = -(xb(1) ^ 2 + xb(2) ^ 2 + xb(2) - 1) 46 ' End Sub x=0.6786 y=0.3885 with Matlab: >>[x,y]=solve('sin(2*x)+y^3=3*x-1','x^2+y=1-y^2') x=0.6786, y=0.3885
5
Sample Solutions: As a result of the equilibrium conditions, the equations given below are obtained for a truss system. How do you calculate the member forces FJD, FFD, FCD and FFC if FCK=6.157 kN and FCB= kN are known? A b F
6
A b F with Matlab clc;clear
Sample Solutions: A b F with Matlab clc;clear A=[ ; ; ; ]; b=[-0.466;0;-6.557;4.353]; F=inv(A)*b FJD= kN FFD= kN FCD= kN FFC= kN
7
Find the roots of the polynomial.
Sample Solutions: Find the roots of the polynomial. with Matlab >> p=[ ] >> roots(p) ans = i i 1.1838 >>ezplot('3*t^4+5*t^2+6*t-20',-2,2)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.