Polynomial coefficients input and even number of elements.

1 回表示 (過去 30 日間)
Nathan Formby
Nathan Formby 2019 年 10 月 3 日
コメント済み: James Tursa 2019 年 10 月 3 日
Prompt the user to enter a vector of coefficients for the polynomial model. Verify that the entry has an even number of elements (an odd number of elements would mean an even order polynomial). If an invalid vector is entered, prompt the user to re-enter the vector until an acceptable vector is entered. If the user does not enter an acceptable vector after 5 attempts (including the first prompt), display a warning and remove the last element of the last vector entered. (For example, if the last user input is [1 2 3 4 5], the vector becomes [1 2 3 4]).
What code do I need exactly?
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 10 月 3 日
The code you need exactly is your homework, and we are not going to do your homework for you.
We will suggest that you read about mod() and rem()
James Tursa
James Tursa 2019 年 10 月 3 日
What have you done so far? Sounds like you need a loop to request inputs until you get what you want. Since there is a limit of 5 attempts, you might want to use a for loop with the index going 1:5. Also look at what the 'break' statement does.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by