Mercurial > repos > public > sbplib
comparison vandermonde.m @ 943:21394c78c72e feature/utux2D
Merge with default
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Tue, 04 Dec 2018 15:24:36 -0800 |
parents | 0090a86d8b72 |
children |
comparison
equal
deleted
inserted
replaced
942:35701c85e356 | 943:21394c78c72e |
---|---|
1 % Create vandermonde matrix for points x and polynomials of order p | |
2 % x is a list of N points of size [N,dim], | |
3 % p is a list of polynomial orders of size [M, dim]. | |
4 % the given mononomials are evaluated and the NxM matrix V is returned. | |
5 function V = vandermonde(x, p) | |
6 assert(size(x,2) == size(p,2), 'x and p must have the same number of columns') | |
7 n = size(x,1); | |
8 m = size(p,1); | |
9 | |
10 for i = 1:m | |
11 V(:,i) = mononomial(x, p(i,:)); | |
12 end | |
13 | |
14 assertSize(V,[n,m]); | |
15 end |