Question: Matlab Question: Given code how would you answer part below? syms x; % Constants a=10; b=7; k=20; % User input w = input('Enter Weight: ');
Matlab Question: Given code how would you answer part below?
syms x;
% Constants a=10; b=7; k=20;
% User input w = input('Enter Weight: '); xl = input('Enter bracket xl: '); xu = input('Enter bracket xu: ');
% Calcuations l0 = sqrt(a^2 + b^2); l = sqrt(a^2 + (b+x)^2); % Length as a function of x W = 2*k*(l-l0)*(b+x)/l; % Relating W value to x for the main equation
% Default initialization xr_old = xl; xr_new = xu;
% Iteration counter iter=1;
fprintf(' Solution By: Name'); fprintf(' Date : Date'); fprintf(' W = %f lb',w); fprintf(' Iteration\tXl(in)\t\tXu(in)\t\tXr(in)\t\terror(%c)','%'); fprintf(' -------------------------------------------------------------------------------------'); while(1) xr_new = (xl + xu)/2; % Bisecting the interval err = abs((xr_new-xr_old)/xr_new); % Calculating error with respect to old root fprintf(' %d\t\t%f\t%f\t%f\t%f',iter,xl,xu,xr_new,err*100); if(err

To verify the functionality of your program, test your program using the weight values listed in Table 1. To record the verification process, open a diary named A5TESTlastname.txt and close it after executing the five test cases. In each case, use an initial bracket estimate of x 0 and xu- 15 inches. Check your program with hand calculations that solve for the weight given the program output deflection (a) and compare the resulting values for the weight in each of the five test cases Table 1. Verification Results Case Weight Program Solution Hand Calculation Check No. W (Ib) (Ib) x (in) 10 20 50 100 2 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
