Search for question
Question

12:11 LTE 29 < Assignment Details CMPSC 200 Programming for Engineers with MATLAB (SU24) Instructions: Complete Problem 1, Problem 2, and Problem 3 below. Remember that the work you submit must be your own. Create a single script (.m file) to complete this assignment. Unless directed otherwise, use meaningful variable names for each variable; do not use the default variable ans to store your results. For this assignment suppress your output with semi-colons ( ; ). Each problem (i.e. Problem 1, Problem 2, and Problem 3) should be in a separate cell, using the cell mode feature of MATLAB. Please remember to follow the Programming Style Convention on Canvas. When complete, please submit your code to the dropbox on Canvas; the grader will run it to view your output. Name your file like this: username_assignment10.m (example: bjs5332_assignment10.m). Your submission must be a single .m file. Problems: Please make sure to print your results for each of these problems using print statements. Submit Assignment « Previous Next 1 47 Dashboard Calendar To Do Notifications Inbox 12:11 LTE 29 < Assignment Details CMPSC 200 Programming for Engineers with MATLAB (SU24) Problems: Please make sure to print your results for each of these problems using print statements. 1. Consider a discrete function given by the values in Table 1. Table 1. A Discrete Function Point i 1 2 3 4 5 x-value 1 2 3 4 5 y-value -1 1 3 5 7 Recalling that for a linear fit the resulting equation should be of the form y = ax + b, find the linear curve fit using: a) The mathematical technique described in Lecture 23 b) The polyfit function 2. Consider the function b(x) = x - x2 + x3. Use the polyval function to evaluate b(x) at the point x = 2, then print the results to the Command Window. 3. Consider the function c(x) = x4 - 5x2 + 4. Find the zeros of the function, then print the results to the Command Window. Submit Assignment « Previous Next 1 47 Dashboard Calendar To Do Notifications Inbox 12:11 LTE 29 Assignment Details < CMPSC 200 Programming for Engineers with MATLAB (SU24) 1. Consider a discrete function given by the values in Table 1. Table 1. A Discrete Function Point i 1 2 3 4 5 x-value 1 2 3 4 5 y-value -1 1 3 5 7 Recalling that for a linear fit the resulting equation should be of the form y = ax + b, find the linear curve fit using: a) The mathematical technique described in Lecture 23 b) The polyfit function 2. Consider the function b(x) = x - x2 + x3 .Use the polyval function to evaluate b(x) at the point x = 2, then print the results to the Command Window. 3. Consider the function c(x) = x4 - 5x2 + 4. Find the zeros of the function, then print the results to the Command Window. Suggestion: You may find it helpful to plot the graph first to get a feel for where the zeros exist; there are exactly 4 zeros for this function. Submit Assignment « Previous Next 1 47 Dashboard Calendar To Do Notifications Inbox