Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program for octave. This is a flow control question. I was told to use pseudocode where possible. Please help. Thank you. A program
Write a program for octave. This is a flow control question. I was told to use pseudocode where possible. Please help. Thank you.
A program is required which can compare the time taken to determine the value of a polyno- mial by individual term calculations and by vectorised methods. The following details must be included Inputs: - Polynomial - a 1x4 row vector of the co-efficients of a polynomial of the form a+ a214 a 11+ao in which the co-efficients are arranged in descending order of power (i.e. [a3 a2 ai aol) - X - a scalar which is the value of the independent variable at which the polynomial must be evaluated Outputs: - ValueLong - a scalar of the value of the polynomial evaluated by individual term calculations ValueShort a scalare of the value of the polynomial evaluated by vectorised meth- ods - TimeLong - a scalare of the execution time of the individual term calculations - TimeShort a scalar of the execution time of the vectorised method - TimeRatio - a scalar of the ratio of TimeLong to Time . The program may display to the console if the student wishes As the required program is a script, it may be assumed that the variables Polynomial and X will exist in the workspace at execution and that the output variables, and only those specified, must remain in the workspace at the end of execution. Students are encouraged to draw a flow chart of the required program to aid in program design. Bonus marks will be awarded for elements of the code which improve the robustness/flexibility thereof such as input checking and re-entry of information if it is incorrect in format or such. Programs are to be submitted via Sakai. Students must submit only their program file named Tutorial4.m. Total: 20 Marks 2 Bonus Marks] Functions which may be useful in completing this laboratory are fliplr; size; sum; and tic/toc. A program is required which can compare the time taken to determine the value of a polyno- mial by individual term calculations and by vectorised methods. The following details must be included Inputs: - Polynomial - a 1x4 row vector of the co-efficients of a polynomial of the form a+ a214 a 11+ao in which the co-efficients are arranged in descending order of power (i.e. [a3 a2 ai aol) - X - a scalar which is the value of the independent variable at which the polynomial must be evaluated Outputs: - ValueLong - a scalar of the value of the polynomial evaluated by individual term calculations ValueShort a scalare of the value of the polynomial evaluated by vectorised meth- ods - TimeLong - a scalare of the execution time of the individual term calculations - TimeShort a scalar of the execution time of the vectorised method - TimeRatio - a scalar of the ratio of TimeLong to Time . The program may display to the console if the student wishes As the required program is a script, it may be assumed that the variables Polynomial and X will exist in the workspace at execution and that the output variables, and only those specified, must remain in the workspace at the end of execution. Students are encouraged to draw a flow chart of the required program to aid in program design. Bonus marks will be awarded for elements of the code which improve the robustness/flexibility thereof such as input checking and re-entry of information if it is incorrect in format or such. Programs are to be submitted via Sakai. Students must submit only their program file named Tutorial4.m. Total: 20 Marks 2 Bonus Marks] Functions which may be useful in completing this laboratory are fliplr; size; sum; and tic/tocStep 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