final (4) - ME 218 (17795) Alan Shu-Ming Kwok (sk25784)...

This preview shows pages 1–5. Sign up to view the full content.

ME 218 (17795) Alan Shu-Ming Kwok (sk25784) Problem 1 1a). Use Matlab’s plotting function to identify the number of intersections these two functions have (plot and identify by eye how many there are and roughly where they are) clear all ; x = -8 : 0.05 : 8; y1 = 3.*x.^3 - 4.*x + 7; y2 = 19.*x.^2 - 30; plot(x,y1, 'b' ,x, y2, 'r' ); title( 'Problem 1 - Find Intersections' ); text(-6,1000, '19x^2 - y - 30 = 0' ); text(-6,-1000, '3x^3 - 4x - y + 7 = 0' );

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
ME 218 (17795) Alan Shu-Ming Kwok (sk25784) Eye-approximation: two intersections around (-1.5,0) , (1.5,0) and (6.5, 700) 1b). Write a MATLAB function that takes an initial guess as an input and uses the vectorial Newton- Raphson’s method to find an intersection of these curves. function Ans = NR(x,y) %Jacobian Matrix Ja = 9*x^2-4; Jb = -1; Jc = 38*x; Jd = -1;
ME 218 (17795) Alan Shu-Ming Kwok (sk25784) J = [ Ja Jb ; Jc Jd ]; f = 3*x^3 - 4*x -y + 7; g = 19*x^2 - y - 30; %NR method Ans = [ x; y ] - (J^-1)*[ f; g]; %recursion NR iterations until results fall 0.001 within previous result if ( abs(Ans - [x;y]) >= [0.001;0.001]) Ans = NR(Ans(1,1),Ans(2,1)); end end 1c). Use your program to find all intersections of these two curves. Hint: select an initial guess near each zero and start the procedure from that point. For your own records, keep tracking the progress of your iterations to make sure that you are converging to the correct intersection and then report iterations for the procedure that successfully converged to each of your intersections >> NR(-1.5,0) Ans = -1.3652 5.0657

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Alan Shu-Ming Kwok (sk25784) Ans = -1.3562 4.9429 ans = -1.3561 4.9424 >> NR(1.5,0) Ans = 1.4601 10.4770 ans = 1.4599 10.4949 >> NR(6.5,700) Ans = 6.2515 711.3583 Ans = 6.2297 707.3698 ans = 6.2296 707.3404 Problem 2 2b) If the pendulum is released from rest at the position given above, use the results of ODE45() to plot the location of each joint for the 2 seconds after release. Create a second graph for a time span of 10 seconds. Both graphs should contain two plots in a single figure, which can be obtained using the subplot command. All plots should be in degrees. function
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/04/2011 for the course ME 218 taught by Professor Unknown during the Spring '08 term at University of Texas at Austin.

Page1 / 14

final (4) - ME 218 (17795) Alan Shu-Ming Kwok (sk25784)...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online