

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


ME2016, Fall 2008, Dr. Ferri Homework Assignment 3 Due Wednesday, September 10, 2008
Problem 1 (5 points) A 4-bar mechanism is a popular mechanism that converts rotary motion of one link to oscillatory or “rocking” motion of another. In the mechanism above, the following dimensions are given: a = 1, b = 2, c = 4, and d = 4. If θ 2 is specified, θ 4 can be obtained as the solution (root) of the following equation:
where
1
2 2 2 2 3
Write a Matlab script that performs the following operations (Use θ 2 = π/6 radians):
(ii) Solves for the closest root to θ 4 = 2 radians using the Matlab function fzero
(iv) Uses the function g to perform a fixed-point algorithm, starting with θ 4 = 2 radians. (v) Automatically stops the fixed-point algorithm when εa < 0.01 %.
Compare the result from your fixed-point algorithm to the answer obtained using fzero.
Anonymous Functions To make an anonymous function in Matlab, use the following syntax. Suppose that we want to
x = 0.5. This can be accomplished with the Matlab commands (in blue), generating the Matlab responses (in black):
>> fc = @(x) (3x.^2 - exp(-2x))./sqrt(x)**
fc =
@(x)(3x.^2-exp(-2x))./sqrt(x)
>> fzero(fc,0.5)
ans =
Problem 2 (3 points) Compute the true, relative, percent error, εt, in the fixed point algorithm of Problem 1; use the value of θ 4 obtained using fzero as the “true root” value. Plot the log of the magnitude of εt vs the iteration number n for n = 1 to 10. What does the plot resemble, especially as n increases?
Problem 3 (2 points) Write a Matlab script that solves for θ 4 - values given a vector of θ 2 – values. In particular, your script should: (i) Take a vector of theta2 = 0:0.01:(2*pi); (ii) At each value of θ 2 in the vector theta2 , solves for θ 4 using fzero and stores the result in a vector, theta. (iii) Plots θ 4 vs θ 2
From inspection of the plot, give the minimum and maximum values attained by θ 4 as θ 2 goes through a complete revolution.