Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask MATLAB Expert

problem 1) prepare a Matlab program that would allow the user to enter coefficients of a polynomial and make some computations. Selections and data entry would be done by presenting the user with a menu (using menu function) and provide her/him with the following choices:

Enter degree and coefficients of the polynomial

Evaluate polynomial at a user defined point

Display roots of the polynomial

Exit

Other Requirements:

Selecting choice 2 and 3 before entering the degree and coefficients will result in an error message.

The program will terminate only when Exit has been selected

Calculations will be done by functions.

Function polynomial() will ask for the degree and the coefficients of the polynomial and would return the coefficients.

Function polyEval() will accept a parameter, the evaluation point, and returns the value of the polynomial at that point.

Function polyRoots() will accept the coefficients and returns the roots.

Results are displayed with 2 decimal place accuracy.

Help with coefficient entry:

a) store the coefficients of the polynomial that have been entered

b) in a vector.  Return coefficients as a vector called p

c) this vector should be global so that other functions can use it global p;
p=[]; %creates an empty polynomial
degree=input('Please enter the degree of the polynomial: ');
j=degree; %this is used for correct message display below
degree=degree+1;
for i=1:1:degree
fprintf('Please enter the coefficient of power %d ',j);
p(i)=input(' ');
j=j-1;
end

d) note the highest degree coefficient is stored in position 1

e) and the next one is position 2 and so on.

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M94613

Have any Question? 


Related Questions in MATLAB

Implement copy-move image forgery detection in matlabpaper

Implement Copy-move image forgery detection in Matlab. Paper - Copy-move image forgery detection based on Gabor magnitude by Jen-Chun Lee. With advancement of media editing software, even people who are not image process ...

Question 11 introductionmeasurements have been made of a

Question 1: 1 Introduction: Measurements have been made of a cantilever beam's deflection (stored in the file ass2q1in.csv). You must determine what type of loading has been applied and the magnitude of the load. There a ...

Problem -the state estimation equation in the discrete

Problem - The state estimation equation in the discrete Kalman filter is x ^ (n|n) = A(n - 1)x ^ (n - 1|n - 1) + K(n)[y(n) - C(n)A(n - 1)x ^ (n - 1|n - 1)] Thus, given the state transition matrix A(n) and the observation ...

Introduction to programming in matlab1 working with matlab

Introduction to Programming in MATLAB 1. Working with MATLAB scalars, vectors, and complex numbers. Using MATLAB, define a unique variable for the following quantities. a. 5 (ex. Define x = 5, etc.) b. 25 2 c. (3 + 4??) ...

Discrete communicationsobjectiverevision of fundamental

Discrete Communications Objective: Revision of fundamental concepts and demonstration of necessary foundation skills. Assessment: The assignment will comprise 20% of your final mark and all ten problems will be of equal ...

It is desired to design a power electronic system referred

It is desired to design a power electronic system, referred to as ‘the device' in below, which has the following specifications: - The device is supplied from a single-phase wall outlet which has a 240 V rms, 50 Hz speci ...

1 you are testing a theory which says that the output

1. You are testing a theory which says that the output displacement of a measurement device should vary with time according to the equation: D(x) = {x 2 cos (x)} / (x +1) So far, you have measured the following set of ex ...

Consider the signal vt given belowwrite a matlab script to

Consider the signal v(t) given below. Write a MATLAB script to do the following (a) Display v(t) and v(2t-1) in window 1 by using subplot. (b) Display both the even component and odd component of v(t) in window 2 by usin ...

Labobjectiveslearn how to create vectors and matrices in

Lab Objectives ? Learn how to create vectors and matrices in MATLAB ? Become familiar with some of the built-in MATLAB functions and how they work Deliverables ? Submit your pre-lab answers in Bblearn under the Lab 2 pre ...

Assignment 1 -question 1 design a pumping system that will

Assignment 1 - Question 1: Design a pumping system that will transfer raw water from Reservoir A to Reservoirs B and C. A control valve shall be located in Line D-C next to Reservoir C to control the share of flow betwee ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate