Answer QUESTION 2 parts A and B using Matlab
SELU-IET ET 202 Computer Applications Fall 2018 HW 05 Solve each problem in a separate script file and name it as Initials-HW 05-pb-##.m. Copy the results from the Command Window function file you should include it in your submission. Make sure that all your script files contain enough comments and description for different steps t file and comment them. If the problem requires a Commands:clc, clear, format compact, sqrt, size, length, fprintf, array indexing, max, min, sum, mean, norm, linspace, colon operator (:), array operations, matrix operations, inv, transpose () poly, roots, polyval, conv, deconv, close plot, xlabel, ylabel, grid, legend, input, function, e, load, save, xlsread, xlswrite, if, else, elseif, end 1 In a script file named Initials_ HW05 pb01.m use ONLY relational operators (D NOT use If statement here) to calculate the values of the following piecewise function y 10-x 7 x 10 Define x as the integer values from-5 to 10 for initial stage of coding. Plot the relation between x and y, add grid and titles (should be similar to the plot appearing below) Once you verify the code, add a step of 0.1 for x values to produce a smoother plot y vs x 54 -2 123456789 10 -2 -3 -5 2. In 2 separate script files named Initials HW 05 pb 02a.m and Initials HW_05_pb_02b.m prompt the user to enter a value for x between -5 and 10 and use it to calculate the value of the piecewise function y given in problem 1 and display both x & y using fprintf Use multiple if statements without else or nested if statements. Use the logical AND (&) but do NOT use elseif a. Draw flow chart. b. Use ONLY ONE if statement with multiple elseif clauses. Draw flow chart. SELU-IET ET 202 Computer Applications Fall 2018 HW 05 Solve each problem in a separate script file and name it as Initials-HW 05-pb-##.m. Copy the results from the Command Window function file you should include it in your submission. Make sure that all your script files contain enough comments and description for different steps t file and comment them. If the problem requires a Commands:clc, clear, format compact, sqrt, size, length, fprintf, array indexing, max, min, sum, mean, norm, linspace, colon operator (:), array operations, matrix operations, inv, transpose () poly, roots, polyval, conv, deconv, close plot, xlabel, ylabel, grid, legend, input, function, e, load, save, xlsread, xlswrite, if, else, elseif, end 1 In a script file named Initials_ HW05 pb01.m use ONLY relational operators (D NOT use If statement here) to calculate the values of the following piecewise function y 10-x 7 x 10 Define x as the integer values from-5 to 10 for initial stage of coding. Plot the relation between x and y, add grid and titles (should be similar to the plot appearing below) Once you verify the code, add a step of 0.1 for x values to produce a smoother plot y vs x 54 -2 123456789 10 -2 -3 -5 2. In 2 separate script files named Initials HW 05 pb 02a.m and Initials HW_05_pb_02b.m prompt the user to enter a value for x between -5 and 10 and use it to calculate the value of the piecewise function y given in problem 1 and display both x & y using fprintf Use multiple if statements without else or nested if statements. Use the logical AND (&) but do NOT use elseif a. Draw flow chart. b. Use ONLY ONE if statement with multiple elseif clauses. Draw flow chart