Answered step by step
Verified Expert Solution
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 lnx using Eq and the
corresponding true relative error tre. For the true value of lnx use Matlabs buildin function logx 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 ie Eq 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 Problem ;
Problem MatlabGrader points, CCOs # & #
Write a script to graph the result of Matlabs logx for x together with the results from myLog for N
and in a single figure. Use the transpose of Matlabs linspace command to generate a column vector x with 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 examFig for the graph before doing any plotting commands, using
examFig figure;
Properly label both axis using the appropriate variable names x lnx
Include a legend for each line, starting with logx followed by N N and N
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:
well commented script source code submitted to Canvas link Exam Problem ;
Problem MatlabGrader points, CCO #& #
Write a script to graph the absolute of the true relative error of Eq as a function of N at x for N 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 examFig for the graph before doing any plotting commands, using
examFig figure
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started