Thread Subject: code to create & fill matrixes of varying sizes

Subject: code to create & fill matrixes of varying sizes

From: Randy Poe

Date: 14 Nov, 2007 17:26:21

Message: 1 of 1

On Nov 14, 12:22 pm, "Jeff G" <matlabstud...@mathworks.com> wrote:
> By the way, I have tried using polyval:
>
> **
> plot(x,y,'o',xx,polyval(A,xx),'--')
> **
>
> But it just seems to plot a straight line

The polynomial coefficients in POLYVAL are in order of
*decreasing* power. That is, the first one is the x^n
coefficient and the last one is the constant term. Could
that be your problem? Try this (if A is a column vector
as you seemed to indicate)

  plot(x,y,'o',xx,polyval(flipud(A),xx),'--')

Use fliplr if A is a row vector.

             - Randy

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com