Newton-Raphson Example 4:

Slides:



Advertisements
Similar presentations
Mechanics of Machines Dr. Mohammad Kilani
Advertisements

Solutions of system of nonlinear equations: Newton-Raphson Example 4: The kinematic equations for a Four-Bar mechanism can be written as (5th semester,
Chapter 7 Numerical Differentiation and Integration
A 10-m long steel wire (cross – section 1cm 2. Young's modulus 2 x N/m 2 ) is subjected to a load of N. How much will the wire stretch under.
Mechanical Vibrations
Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the polynomial intersects the horizontal axis (the function.
Area of a single trapezoid = h
MECN 3500 Inter - Bayamon Lecture Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Simpson Rule For Integration.
From a vibration measurement on a machine, the damping ratio and undamped vibration frequency are calculated as 0.36 and 24 Hz, respectively. Vibration.
Numerical Methods For Slides Thanks to Lecture 6 Interpolation
Centroids and Centers of Gravity
Interpolation produces a function that matches the given data exactly. The function then can be utilized to approximate the data values at intermediate.
Simpson’s Rule: Example: Calculate the integral of the given function.
CHAPTER 3 NUMERICAL METHODS
Solutions of system of nonlinear equations: Newton-Raphson Example 4: The kinematic equations for a Four-Bar mechanism can be written as (5th semester,
Ship Computer Aided Design Displacement and Weight.
Theoretical Mechanics STATICS KINEMATICS
, Free vibration Eigenvalue equation EIGENVALUE EQUATION
The formulae for the roots of a 3rd degree polynomial are given below
CSE 330: Numerical Methods. Introduction The bisection and false position method require bracketing of the root by two guesses Such methods are called.
CHAPTER 3 NUMERICAL METHODS
Air Force Admin College, Coimbatore
Section 3.2 Polynomial Functions and Their Graphs
Mechanical Vibrations
LECTURE 4 OF SOLUTIONS OF NON-LINEAR EQUATIONS OBJECTIVES
Chapter 7 Numerical Differentiation and Integration
The formulae for the roots of a 3rd degree polynomial are given below
The formulae for the roots of a 3rd degree polynomial are given below
1. 2 What is Integration? Integration The process of measuring the area under a curve. Where: f(x) is the integrand a= lower limit of integration b=
1. Plotting Graph with Matlab:
Equations of Motion: Kinetic energy: Potential energy: Sin≈
Smooth, Continuous Graphs
Area of a single trapezoid = h
Distributed Forces: Centroids and Centers of Gravity
Section 3.2 Polynomial Functions and Their Graphs
Equations of Motion: Kinetic energy: Potential energy: Sin≈
1. Plotting Graph with Matlab:
The formulae for the roots of a 3rd degree polynomial are given below
MATH 2140 Numerical Methods
1. Plotting Graph with Matlab:
Example: Obtain the equation of motion of the mechanical system given below. Write the form of the output θ(t) in case of free vibration and determine.
Trapezoidal Rule of Integration
Algebra: Graphs, Functions, and Linear Systems
3. LAGRANGE INTERPOLATION METHOD
POLYNOMIAL INTERPOLATION
ENGINEERING MECHANICS
4.7 STRESS CONCENTRATIONS
Area of a single trapezoid = h
Equations of Motion: Kinetic energy: Potential energy: Sin≈
Simpson’s Rule: Example: Calculate the integral of the given function.
Section 2.3 Polynomial Functions and Their Graphs
Section 3.2 Polynomial Functions and Their Graphs
The formulae for the roots of a 3rd degree polynomial are given below
1. Plotting Graph with Matlab:
Assignment 1: due 1/16/19 Estimate all of the zero of x3-x2-2x+1 graphically. Write a MatLab code for Newton’s method. Use your code to refine the graphical.
Area of a single trapezoid = h
Newton-Raphson Example 4:
Numerical Computation and Optimization
Find u,w ve z with computer?
Newton-Raphson Example 4:
3. LAGRANGE INTERPOLATION METHOD
Calculate the integral with; a) Trapezoidal rule b) Simpson’s rule
1. Plotting Graph with Matlab:
The formulae for the roots of a 3rd degree polynomial are given below
Newton-Raphson Example 4:
The formulae for the roots of a 3rd degree polynomial are given below
Air Force Admin College, Coimbatore
Presentation transcript:

Newton-Raphson Example 4: Solutions of system of nonlinear equations: Newton-Raphson Example 4: The kinematic equations for a Four-Bar mechanism can be written as (5th semester, Mechanisms Course) L2=0.15 m L3=0.45 m L4=0.28 m s1=0.2 m s1 L2 L3 L4 θ2 θ3 θ4 3 4 2 1 Where link 2 is the input member. How do you calculate θ3 and θ4 when θ2=120°. -0.075 0.13

Following changes are made in the computer program. Solutions of system of nonlinear equations: Following changes are made in the computer program. clc, clear x=[0.5 1] ; err=[0.01 0.01]; niter1=10;niter2=50; err=transpose(abs(err)); for n=1:niter2 x %Error Equations--------------------------- a(1,1)=-0.45*sin(x(1));a(1,2)=0.28*sin(x(2)); a(2,1)=0.45*cos(x(1));a(2,2)=-0.28*cos(x(2)); b(1)=-(0.45*cos(x(1))-0.28*cos(x(2))-0.275); b(2)=-(0.13+0.45*sin(x(1))-0.28*sin(x(2))); %---------------------------------------------- bb=transpose(b);eps=inv(a)*bb;x=x+transpose(eps); if n>niter1 if abs(eps)<err break else display ('Roots are not found') end (Initial angle values must be given in RADIAN) ANSWER: θ3=0.216 rad (12.37°) θ4=0.942 rad (53.97°)

Newton-Raphson Example 5: Solutions of system of nonlinear equations: Newton-Raphson Example 5: Kinematic equations for a crank mechanism are given below (5th semester Mechanisms Course) L2=0.15 m L3=0.6 m θ3 L2 L3 θ2 s Where link 2 (crank) is the input member. How dou you calculate θ3 and s with computer when θ2=60°. 0.075 0.1299

Following changes are made in the computer program. Solutions of system of nonlinear equations: Following changes are made in the computer program. clc, clear x=[-1 0.8] ; err=[0.01 0.01]; niter1=10;niter2=50; err=transpose(abs(err)); for n=1:niter2 x %Error Equations--------------------------- a(1,1)=-0.6*sin(x(1));a(1,2)=-1; a(2,1)=0.6*cos(x(1));a(2,2)=0; b(1)=-(0.075+0.6*cos(x(1))-x(2)); b(2)=-(0.1299+0.6*sin(x(1))); %---------------------------------------------- bb=transpose(b);eps=inv(a)*bb;x=x+transpose(eps); if n>niter1 if abs(eps)<err break else display ('Roots are not found') end ANSWER: θ3=-0.2182 rad (-12.5°) s=0.6607 m

Example 1: Given: z=0.36 ω0=24*2*π (rad/s) A=1.2 Graph Plotting: Example 1: From a vibration measurement on a machine, the damping ratio and undamped vibration frequency are calculated as 0.36 and 24 Hz, respectively. Vibration magnitude is 1.2 and phase angle is -42o. Write the MATLAB code to plot the graph of the vibration signal. Given: z=0.36 ω0=24*2*π (rad/s) A=1.2 Φ=-42*π/180 (rad)=-0.73 rad ω0=150.796 rad/s ω -σ α

yt=1.2*exp(-54.3*t).*cos(140.7*t+0.73); plot(t,yt) xlabel(‘Time (s)'); Graph Plotting: clc;clear t=0:0.002:0.1155; yt=1.2*exp(-54.3*t).*cos(140.7*t+0.73); plot(t,yt) xlabel(‘Time (s)'); ylabel(‘Displacement (mm)');

Example 2: The time-dependent locations of two cars denoted by A and B Solutions of system of nonlinear equations: Example 2: The time-dependent locations of two cars denoted by A and B are given as At which time t, two cars meet?

Newton-Raphson Example 2: Solutions of system of nonlinear equations: Newton-Raphson Example 2: clc;clear t=fzero(@(t)t^3-t^2-4*t+3,1); vpa(t,6) Alternative Solutions with MATLAB clc, clear x=1;err=0.001; niter=20; %---------------------------------------------- for n=1:niter f=x^3-x^2-4*x+3; df=3*x^2-2*x-4; if abs(f)<err break end eps=-f/df; x =x+eps; display('Answer is='),x Using roots command in MATLAB a=[ 1 -1 -4 3]; roots(a) ANSWER t=0.713 s t=2.198 s

Simpson’s Rule: Example 3: Calculate the integral of the given function. -1.4 4.2i

>>f=2.5*exp(-1.4*teta)*cos(4.2*teta+1.4) >>y=int(f,0,4.49) Simpson’s Rule: k θ M(θ) 0.4249 1 0.3742 -1.4592 2 0.7484 -0.1476 3 1.1226 0.5119 4 1.4968 0.0512 5 1.8710 -0.1796 6 2.2452 -0.0178 7 2.6194 0.0630 8 2.9936 0.0062 9 3.3678 -0.0221 10 3.7420 -0.0021 11 4.1162 0.0078 12 4.49 0.000744 Solution with Matlab: >>clc;clear; >> syms teta >>f=2.5*exp(-1.4*teta)*cos(4.2*teta+1.4) >>y=int(f,0,4.49) >>vpa(y,5) I=-0.4966

Simpson’s Rule: Example 4: k θ M2(θ) 0.1806 1 0.3742 2.1293 2 0.7484 0.1806 1 0.3742 2.1293 2 0.7484 0.0218 3 1.1226 0.2621 4 1.4968 0.0026 5 1.8710 0.0323 6 2.2452 0.000316 7 2.6194 0.0040 8 2.9936 3.81x10-5 9 3.3678 4.88x10-4 10 3.7420 4.598x10-6 11 4.1162 6.013x10-5 12 4.49 5.541x10-7

Simpson’s Rule: Solution with Matlab: >>clc;clear; >> syms teta >>f=(2.5*exp(-1.4*teta)*cos(4.2*teta+1.4))^2 >>y=int(f,0,4.49) >>vpa(y,5) I=0.898 We must increase the number of sections!

>>syms x; area=int((x+1)/(sqrt(x^2+4)),0,1.2);vpa(area,5) Simpson’s Rule: Example 5: Calculate the volume of the 3meter-long beam whose cross section is given in the figure. k x y(x) 0.5 1 0.2 0.597 2 0.4 0.6864 3 0.6 0.7663 4 0.8 0.8356 5 1.0 0.8944 6 1.2 0.9432 Solution with Matlab: >>syms x; area=int((x+1)/(sqrt(x^2+4)),0,1.2);vpa(area,5) Area=0.9012

Lagrange Interpolation: Example 6: The temperature (T) of a medical cement increases continuously as the solidification time (t) increases. The change in the cement temperature was measured at specific instants and the measured temperature values are given in the table. Find the cement temperature at t=36 (sec). Thermometer With Matlab: >>clc;clear >> t=[5 15 55]; >> T=[30 43 68]; >> interp1(t,T,36,'spline') Medical cement

Lagrange Interpolation: Example 7: The buckling tests were performed in order to find the critical buckling loads of a clamped-pinned steel beams having different thicknesses. The critical buckling loads obtained from the experiments are given in the table. Find the critical buckling load Pcr (N) of a steel beam with 0.8 mm thickness. Pcr Thickness (t) (mm) Buckling Load Pcr (N) 0.5 30 0.6 35 0.65 37 0.73 46 0.9 58 0.8 mm

v=load ('c:\saha\data.txt') interp1(v(:,1),v(:,2),0.8,'spline') Lagrange Interpolation: Pcr Thickness (t) (mm) Buckling Load Pcr (N) 0.5 30 0.6 35 0.65 37 0.73 46 0.9 58 1. Lagrange Interpolation with Matlab clc;clear t=[0.5 0.6 0.65 0.73 0.9]; P=[30 35 37 46 58]; interp1(t,P,0.8,'spline') 0.8 mm 2. Lagrange Interpolation with Matlab clc;clear v=load ('c:\saha\data.txt') interp1(v(:,1),v(:,2),0.8,'spline') 0.5,30 0.6,35 0.65,37 0.73,46 0.9,58 data.txt

Find the roots of the polynomial. Roots of a polynomial: Example 8: Find the roots of the polynomial. with Matlab >> p=[3 0 5 6 -20] >> roots(p) ans = -1.5495 0.1829 + 1.8977i 0.1829 - 1.8977i 1.1838 >>ezplot('3*t^4+5*t^2+6*t-20',-2,2)

Solution of system of nonlinear equations: Example 9: How do you find x and y values, which satisfy the equations? clc, clear x=[1 1]; err=[0.01 0.01]; niter=50; err=transpose(abs(err)); for n=1:niter %-----Error equations------------------------ a(1,1)=2*cos(2*x(1))-3;a(1,2)=3*x(2)^2; a(2,1)=2*x(1);a(2,2)=2*x(2)+1; b(1)=-(sin(2*x(1))+x(2)^3-3*x(1)+1); b(2)=-(x(1)^2+x(2)^2+x(2)-1); %------------------------------------------------------- bb=transpose(b); eps=inv(a)*bb; x=x+transpose(eps); if abs(eps)<err display ('Roots are found as'), x break elseif n==niter display ('Roots are not found') end x=0.6786 y=0.3885

Solution of system of nonlinear equations: Example 10: How do you calculate a and b, which satisfy given equations by computer? clc, clear x=[1 1]; err=[0.01 0.01]; niter=50; err=transpose(abs(err)); for n=1:niter %-----Error equations------------------------ a(1,1)=6*x(1);a(1,2)=4*x(2); a(2,1)=6*x(1)^2;a(2,2)=2*(x(2)-1); b(1)=-(3*(x(1)^2-1)+2*x(2)^2-11); b(2)=-(2*x(1)^3+(x(2)-1)^2-16); %------------------------------------------------------- bb=transpose(b); eps=inv(a)*bb; x=x+transpose(eps); if abs(eps)<err display ('Roots are found as'), x break elseif n==niter display ('Roots are not found') end a=2 b=1

clc;clear x=[3 8 10]; P=[7 6.2 6]; interp1(x,P,5,'spline') Lagrange Interpolation: Example 11: 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 MATLAB code is given as clc;clear x=[3 8 10]; P=[7 6.2 6]; interp1(x,P,5,'spline')

clc;clear x=[25 40 70]; y=[-10 20 5]; interp1(x,y,50,'spline') Lagrange Interpolation: Example 12: The x and y coordinates of three points on the screen, which were clicked by a CAD user are given in the figure. Find the y value of the curve obtained from these points at x=50. How do you find the answer with computer? x y 25 -10 40 20 70 5 clc;clear x=[25 40 70]; y=[-10 20 5]; interp1(x,y,50,'spline') Result: 26.111 b) How do you find the answer manually?

Example 14: Calculate the integral with; a) Trapezoidal rule Simpson’s Rule: Example 14: Calculate the integral with; a) Trapezoidal rule b) Simpson’s rule (take n=4), c) Using MATLAB. a) Trapezoidal rule: Divide into four equal sections 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

>>I=int(sqrt(tet)*cos(tet),0.5,1); >>vpa(I,5) I=0.30796 Simpson’s Rule: b) Simpson’s rule: using Matlab >>syms tet >>I=int(sqrt(tet)*cos(tet),0.5,1); >>vpa(I,5) I=0.30796

Lagrange Interpolation + Simpson’s Rule: Example 15: For a steel plate weighing 10 N and has a thickness 2 mm, the coordinates of some points shown in the figure were measured (in cm) by a Coordinate Measuring Machine (CMM). How do you calculate the density of the steel by fitting a curve, which passes through these points. ? a) Manual calculation: The volume of the part is calculated by using its surface area and 0.2 cm thickness value. The simpson’s rule is used for area calculation. The x axis must be divided in equal segments in this method. Since the points are not equally spaced on the x axis, the necessary y values should be calculated at suitable x values. x y 5 2.5 7.8 3.7 9.3 4 10 If we divide the interval 0-4 into four equal sections using the increment ∆x=1 , we can obtain the y values for x=1, x=2 and x=3.

Lagrange Interpolation + Simpson’s Rule: x y 5 1 6.763 2 7.4969 3 8.2323 4 10

Lagrange Interpolation + Simpson’s Rule: b) With computer: For calculation with computer, MATLAB code is arranged to find the y values for x=1, x=2 and x=3 and the code Lagr.I is run. clc;clear x=[0 2.5 3.7 4]; y=[5 7.8 9.3 10]; interp1(x,y,1,'spline') interp1(x,y,2,'spline') interp1(x,y,3,'spline') The area of the plate can be calculated by using Simpson’s rule. Then, the density of the steel can be calculated as mentioned before.

Simpson’s Rule: Example 16: A stationary car starts to move with the acceleration given below Find the speed of the car at the end of 10 seconds Manually With computer a) k t f 1 2.5 0.40216 2 5 0.0753 3 7.5 0.2358 4 10 0.18178 b) With computer using Matlab >>syms t >>I=int((1+sin(t)^3)/sqrt(t^2+1),0,10);vpa(I,5)

>>I=int(3*x-x^2-2,1,2);vpa(I,5) Simpson’s Rule: Example 17: Find the intersection area of the curves y=x2+2 and y=3x . Roots >> roots([1 -3 2]) k x f 1 1.25 0.1875 2 1.5 0.25 3 1.75 4 using Matlab >>syms x >>I=int(3*x-x^2-2,1,2);vpa(I,5)

Example 18: With Matlab clc;clear a=[-1 1 -3;0 3 -6;1 1 1]; System of linear equations: Example 18: How do you calculate u,w and z with computer? With Matlab clc;clear a=[-1 1 -3;0 3 -6;1 1 1]; b=[9;12;5]; c=inv(a)*b

System of linear equations: Example 19: 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=-3.888 kN are known? A b F

A b F with Matlab clc;clear System of linear equations: A b F with Matlab clc;clear A=[-1 -0.707 -0.894 0;0 -0.707 -1 0;3 0 0 2.365;0 0 0.894 1]; b=[-0.466;0;-6.557;4.353]; F=inv(A)*b FJD= 1.5429 kN FFD= -14.3701 kN FCD= 10.1596 kN FFC= -4.7297 kN