Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Matlab function myLog that takes as input x and the number N and outputs as y the estimate of ln ( x )

Write a Matlab function myLog that takes as input x and the number N and outputs as y the estimate of ln(x) using Eq.(1) and the
corresponding true relative error tre. For the true value of ln(x) use Matlabs build-in function log(x) here and in the following
problems. Code the function such that it can handle both scalar and column vector inputs for x, resulting in scalar, respective
column vector outputs for y and tre. If any of the values for x are x <=1/2, i.e., Eq.1 is not applicable, call Matlabs error
function and output an appropriate error message. Do not print any results to screen or do any plotting within the function.
Required submission:
well commented script source code submitted to Canvas link Exam 1- Problem 2;
Problem 3/ MatlabGrader (7 points, CCOs #1 & #11)
Write a script to graph the result of Matlabs log(x) for 0.500001<= x <=10 together with the results from myLog for N =2,
8, and 16 in a single figure. Use the transpose of Matlabs linspace command to generate a column vector x with 1001 equally
spaced points covering the entire requested range of x values to generate the data for the plot.
Notes for the MatlabGrader script submission:
Comment out clear or clear all in your script when submitting to MatlabGrader.
Generate and store the figure handle examFig1 for the graph before doing any plotting commands, using
examFig1= figure(1);
Properly label both axis using the appropriate variable names (x, ln(x)).
Include a legend for each line, starting with log(x) followed by N =2, N =8, and N =16.
Ensure that your legend does not obstruct any part of your plot.
Do not include the source code for myLog in your script. A correct version is used automatically on Matlab Grader.
Required submission:
2 well commented script source code submitted to Canvas link Exam 1- Problem 3;
Problem 4/ MatlabGrader (5 points, CCO #1& #11)
Write a script to graph the absolute of the true relative error of Eq.(1) as a function of N at x =5 for N =1,2,3,...200. Use a
logarithmic scale for the error and a linear scale for N (Matlabs semilogy()).
Notes for the MatlabGrader script submission:
Comment out clear or clear all in your script when submitting to MatlabGrader.
Generate and store the figure handle examFig2 for the graph before doing any plotting commands, using
examFig2= figure(2)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions