Triple Summation in Matlab

조회 수: 2 (최근 30일)
Jalal Hassan
Jalal Hassan 2020년 6월 28일
편집: Jalal Hassan 2020년 6월 29일
Following Formula uses triple index summation.
How can I achieve this in matlab. All of the terms being summed are row vectors ( coefficients of polynomial ) except f(xi , yj , zk) is a row vector of numbers.
  댓글 수: 5
Walter Roberson
Walter Roberson 2020년 6월 29일
size of f(xi ,yj ,zk) is equal to (size of x) * (size of y) * (size of z)
That means that given scalar xi, yj, zk, then f(xi, yj, zk) is a 3 dimensional array. A 3 dimensional array is not a "row vector"
p=length(x)
That disagrees with p=2 for x = [x0 x1 x2] . It looks to me as if p is the degree of the polynomial implied by x, which would be length(x)-1
This simply means that from lagrange coefficients matrix we have to use first row which is a polynomial.
As in sum(L3(1,:) .* x.^(length(x)-1:-1:0)) ?
Jalal Hassan
Jalal Hassan 2020년 6월 29일
편집: Jalal Hassan 2020년 6월 29일
I calculated all of the possible combinations of f(xi ,yj ,zk) by using following code
syms x y z
f = @(x,y,z)x.*y+z; % Insert your function
x = [ 0.05 0.06 ];
y = [ 1.23 1.41 ];
z = [ 0.1 0.2];
[XX,YY,ZZ] = meshgrid(x,y,z); % Create all possible combinations
Q = f(XX(1:end),YY(1:end),ZZ(1:end))
It gives a 1x8 matrix containg all of the function values. These are just numbers.
For value of p, I'll give an example
consider following matrix
x = [x0 x1 x2 x3]
As you can see last entry is x3, so p=3. Similarly, if last entery is x2 or x4, p will be 2 and 4 respectively.
Now consider
x = [x1 x2 x3 x4]
we will sum from 1 to 4, thereby p=4 whereas in above example p=3 but we are going to sum from 0 to 3, both of which are same i.e., number of terms which are being summed are 4.
For Lagrange coefficients, I think we can use conv to multiply them beacause these are Lagrange Polynomials.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by