Code covered by the BSD License  

Highlights from
Vandermonde matrix, vander() function extension

Be the first to rate this file! 10 Downloads (last 30 days) File Size: 1.29 KB File ID: #43968

Vandermonde matrix, vander() function extension

by

 

17 Oct 2013 (Updated )

Adds functionality to the original MATLAB vander() function.

| Watch this File

File Information
Description

Uses the more common definition of the Vandermonde matrix with power zero to the left, and adds the ability to create non-square matrices for more flexibility.

V=vander2(v,k)=[v.^0 v.^1 ... v.^k];
where length(v)=n and dim(V)=[n, k].

Note that replacing the original vander() function can cause other functions to fail.

MATLAB release MATLAB 8.2 (R2013b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
01 Nov 2013 Marcus Björk

Thanks for the comments guys! Indeed, its a bad idea to REPLACE vander with this function, so I changed the name and made a note in the text. However, one of the points was to use the normal definition, so I won't change that. I also added bsxfun instead of the for-loop, that was just bad...

25 Oct 2013 John D'Errico

The code uses a loop to build the array too. Simple enough is just:

A = bsxfun(@power,v(:),k:-1:0);

No preallocation is even needed.

This also fixes the problem that Jan points out, i.e., that this tool as it currently is will totally break any code that assumed the order from the original gander. That is indeed a serious flaw. Do yourself a favor, and do NOT download this tool until the author is willing to update it to function correctly.

25 Oct 2013 Jan Simon

It is a very bad idea to shadow the original function "vander" by this version. The new feature, which allows the specification of the number of columns might be useful, but the order of columns has changed. In consequence several toolbox functions will reply wrong results.

Updates
01 Nov 2013

Changed function name to vander2 not to replace original (since the output is changed).
Replaced for-loop by bsxfun.

Contact us