Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

My first Script (polynomials)

0 views
Skip to first unread message

dishes

unread,
Oct 28, 2009, 7:12:47 AM10/28/09
to
I need to make a function that differentiates a polynomial. It needs to be in the form: function dy = differ(a, x), where a is a vector of any length representing the coefficients of the polynomial, and x is a vector of any length giving the points at which the derivative is evaluated.

For example, if a = [2 4 7 3 4], it would be 2x^4 + 4x^3 + 7x^2 + 3x + 4.
And say x = [1 2 4 5]. The program should take a and differentiate it (in this case giving 8x^3 + 12x^2 + 14x + 3) and then apply it to the values in the vector x. So this input would return 37, 143, 763, 1373.

Another example, if a = [1 2 0 1] (meaning 1x^3 + 2x^2 + 1 which is differentiated to 3x^2 + 4x) and x = [1 2 3], then the output would be 7, 20, 39.

I cannot use existing matlab functions here. Does anyone know how i would go about making this function? Thanks.

the cyclist

unread,
Oct 28, 2009, 8:44:19 AM10/28/09
to
dishes <fartybar...@hotmail.com> wrote in message <1035469021.125241.1256...@gallium.mathforum.org>...

Everything you have said here points to this being a homework problem. People here are more inclined to give homework hints when the student first exhibits some genuine effort at having solved it themselves.

the cyclist

dishes

unread,
Oct 28, 2009, 9:26:33 AM10/28/09
to
ok I think im on a role atm, but i will prob need you guys help later ^^
0 new messages