comparison mononomial.m @ 832:5573913a0949 feature/burgers1d

Merged with default, and updated +scheme/Burgers1D accordingly
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 11 Sep 2018 15:58:35 +0200
parents 0090a86d8b72
children
comparison
equal deleted inserted replaced
831:d0934d1143b7 832:5573913a0949
1 % calculate a N-D mononomial with powers k in points x:
2 % z = x(:,1).^k(1) * x(:,2).^k(2) * ...
3 function z = mononomial(x, k)
4 assert(size(x,2) == length(k), 'k must have the same length as the width of x');
5
6 if any(k < 0)
7 z = x(:,1)*0;
8 return
9 end
10
11 denom = prod(factorial(k));
12
13 for i = 1:length(k)
14 x(:,i) = x(:,i).^k(i);
15 end
16 z = prod(x,2)/denom;
17 end