Matlab Function for name algorithm

Somebody please help I have no idea what I am doing. Any tips or advice will be appreciated!
Write a function that will take a single input: a number x It will return a single number that represents p(x) where p is a polynomial that represents your surname, according to the following algorithm.
1. Replace each letter of your surname by the positive integer it corresponds to in the alphabet: a is replaced by 1, b is replaced by 2, and so on.
2. Subtract 13 from each of those numbers
3. Divide each of those numbers by 6
4. Divide each of those numbers by 2^(i−1) where i represents the position of the letter in the array. I.e. the first number is divided by 2^0 the second number by 2^1 and so on. 5.Label the resulting numbers in order where n is the number of letters in your name. The polynomial is
p(x)=a0+a1x+⋯+an−1x^(n−1).
For example, if your name were Lee, the steps would go like this. 1. [12 5 5]
2.[-1 -8 -8]
3.[-0.1667 -1.333 -1.333]
4.[-0.1667 -0.6667 -0.3333]
5.p(x)=−0.1667−0.6667x−0.3333x2

Answers (1)

hint: the assignment requirements do not require that the polynomial be generated at run time. You can calculate everything ahead of time and just implement the polynomial.

Categories

Asked:

on 28 Jun 2016

Answered:

on 28 Jun 2016

Community Treasure Hunt

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

Start Hunting!