Numerical Methold, plz solve asap. let me know, if you have any question 2986616
ID: 1718483 • Letter: N
Question
Numerical Methold, plz solve asap. let me know, if you have any question 298661607@qq.com
In this problem you will compare the performance of two Bracketing Methods in finding the roots of mechanical system equations. Use a stopping criterion of euler_a = 10^-10 for each problem, where euler_a is the approximate relative error given by euler_a = ?(x^new_e - x^old_e)/x^new_e?. For each problem below, write a MATLAB script for each problem that finds the roots of the specified equations using both the Bisection Method and the False Position method. The code for each problem should print to screen the number of iterations required and the final root estimate for each bracketing method. It should also generate a plot comparing the decrease in root estimate error with increasing search iteration i for each method (on the same plot). Use semilogx to plot the figure with a log scale x-axis. Include the figures in your pdf write-up. Beam Deflection: Given the elastic deflection equation for a beam with the boundary and loading conditions shown below, determine the maximum downward deflection (i.e. where dy/dx = 0) of a beam under the linearly increasing load w_0 = 10 kN/m. Use the following parameter values: L = 10m, E = 5 times 10^8 kN/m^2, I = 3 times 10^-4 m^4. Use the initial bracket guesses of X_L = 0 m and x_U = 10 m. y(x) = w_0/120EIL (-x^5 + 2L^2 x^3 - L^4 x) Optimal Step Size: The equation for the limit on total numerical approximation error euler_tot with respect to step size h is given by the following equation: euler_tot(h) = euler/h + h^2M/6 For find the optimal step size h_opt of an approximation using a 32-bit IEEE 754 floating point number and a third-order Taylor Series approximation of the function in Problem 2. The optimal step size is that for which the total numerical error is minimized and the slope of the total error function is zero (i.e. d euler_tot/dh = 0). Use initial bracket guesses of X_L = 10^-8 and x_U = 10^0. Exponential Function: Use the Bisection and False Position methods to find the roots of the equation f(x) = x^6 - 100. Start with initial bracket guesses of X_L = 0 and x_U = 10.Explanation / Answer
Matlab Code Bisection Method
function p = bisection(f,a,b)
% provide the equation you want to solve with R.H.S = 0 form.
% Write the L.H.S by using inline function
% Give initial guesses.
% Solves it by method of bisection.
% A very simple code. But may come handy
if f(a)*f(b)>0
disp('Wrong choice bro')
else
p = (a + b)/2;
err = abs(f(p));
while err > 1e-7
if f(a)*f(p)<0
b = p;
else
a = p;
end
p = (a + b)/2;
err = abs(f(p));
end
end
Sample Output
>> f = @(x) x^6-100;
>> bisection(f,0,10)
ans =
2.1544
Matlab Code False Position Method
function root = regulafalsi(f,a,b)
i = 0;
g = 1;
tolerance = 1*10^-4;
while(g > tolerance)
i = i + 1;
c = a - ((f(a)*(b-a))/(f(b) - f(a)));
if(f(c)*f(a) > 0)
b = c;
g = f(b);
root = b;
else
a = c;
g = f(a);
root = a;
end
end
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.