Matlab assignment
CA4-macm-2023 MACM 316 - Computing Assignment 4 • Read the Guidelines for Assignments first. • Submit a one-page PDF report to Crowdmark and upload your Matlab scripts (as m-files) to Canvas. Do not use any other file formats. • Keep in mind that Canvas discussions are open forums. • You must acknowledge any collaborations/assistance from colleagues, TAs, instructors etc. By default, the Matlab spline command uses the so-called not-a-knot end conditions. In this assignment, you may use the spline() function that is built into Matlab. Part A: In Matlab, construct a cubic spline with not-a-knot end conditions to approximate by using the values given by at . Use the derivatives of the spline to approximate and . What are the absolute errors in your spline-based approximation?
Part B: In Matlab, repeat Part A over the interval [0, 1] with equal node spacings . Tabulate or form a plot of the absolute error for and as a function of . Using big-oh notation describe the error in your approximations to and as a function of . Your answer here should be of the form : what is ? Explain how you find
f (x) = e−x − 1/2 f (x) x = 0, 0.25, 0.5, 0.75, 1.0 f′ (0.5) f′ ′ (0.5) h = 2−m, m = 2,3,4,… f′ (0.5) f′ ′ (0.5) h f′ (0.5) f′ ′ (0.5) h O(hp) p p . MACM 316 - Computing Assignment 4
Continued on page 2 Your report cannot exceed one page. It should include at least one figure or table with proper labels. Make sure to choose axis scales appropriate for the data. Discussions should be kept brief and answer all questions asked. Point out key features, and state the take-home message for each figure/ table. Submit your 1 page report for this question to Crowdmark in .pdf format according the Assignment Guidelines described in the syllabus. Submit your Matlab code to Canvas "Computing Assignment 4 - Matlab Code”. Do not include identifying information on your report. After marking, we will post a few exemplary reports as sample solutions. We appreciate your support on this. If you do not wish to have your report posted, please state so at the top of your report. Continued on page 3 https://canvas.sfu.ca/courses/24474/files/3614066/download MACM 316 - Computing Assignment 4 Grades will be based on 5 criteria: Writing / Clarity and conciseness: 2 marks: Writing is clear and concise 1 mark: Contains minor spelling or grammatical errors, too brief or too long, does not convey the main ideas 0 marks: Writing quality is poor and cannot be understood easily or at all
Data:
2 marks: Data is correct, well presented and relevant to the report
1 mark: some data is missing, unimportant data is included 0 marks: No data, data is incorrect, data is irrelevant, poor presentation
Correctness:
2 marks: In Part A, derivatives and absolute errors are correct
1 mark: Minor errors in part A
0 marks: Derivatives are incorrect, poorly presented or correctness unclear. Rate of convergence for :
2 marks: Complete and correct analysis and discussion
1 mark: An appropriate value of p is given but use of data is not fully appropriate, or discussion is incomplete.
0 marks: Analysis and discussion missing, incomplete, and/or incorrect Rate of convergence for :
2 marks: Complete and correct analysis and discussion
1 mark: An appropriate value of p is given but use of data is not fully appropriate, or discussion is incomplete.
0 marks: Analysis and discussion missing, incomplete, and/or incorrect f′ f′ ′