Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For all questions you are allowed to use the following build-in functions of MatLab: linspace, zeros, sum, disp, , length, log, close all, clearvars, clc.
For all questions you are allowed to use the following build-in functions of MatLab: linspace, zeros, sum, disp, \, length, log, close all, clearvars, clc.
Grading criteria: Correctness Justification Efficiency Presentation
1. Write a MatLab user-defined function that determines the coefficients of a cubic polynomial, f(x)=azx? +a_x +2x+a, , that best fits a given set of data points. The function should also calculate the overall error E. Name the function [a,Er] = CubPolFit(x,y), where the input arguments x and y are vectors with the coordinates of the data points, and the output argument a is a four-element vector with the values of the coefficients az,a,,a,a,. The output argument Er is the value of the overall error. (a) Use CubPolFit to find the cubic polynomial that best fits the data in the rubber tension tests (see lecture slides) Curve fitting - polynomial regression - Example A tension test is conducted for determining the stress-strain be- havior of rubber. The data points from the test are shown in the figure, and their values are given below. Determine the fourth order polynomial that best fits the data points. Make a plot of the data points and the curve that corresponds to the polynomial. Strain 0 0.4 0.8 1.2 1.6 2.0 2.4 Stress (MPa) 0 3.0 4.5 5.8 5.9 5.8 6.2 Strain 2.8 3.2 3.6 4.0 4.4 5.2 5.6 6.0 Stress (MPa) 7.4 9.6 15.6 20.7 26.7 31.1 35.6 39.3 41.5 (b) Write a program in a script file that plots the data points and the curve of the cubic polynomial that best fits the data. Submit pdf with the results and MatLab filesStep 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