Using kron is a sensible option for this cross product of Td1 and Td2 and creating Td as a function?
Ältere Kommentare anzeigen
function Td1 = compute_Td1(M)
% Create a matrix of binomial coefficients
[I, J] = ndgrid(1:M, 1:M);
binomials = zeros(M, M);
for i = 1:M
binomials(i, 1:i) = arrayfun(@(ii, jj) nchoosek(ii-1, jj-1), I(i, 1:i), J(i, 1:i));
end
% Create a matrix for powers
powers = ((- (M - 1) / 2) .^ (I - J)) .* (J <= I);
% Element-wise multiplication to get Td1
Td1 = binomials .* powers;
end
function Td2 = compute_Td2(M)
% Initialize Td2 with identity
Td2 = eye(M+1);
for n = 2:M+1
for k = 2:n-1
Td2(n, k) = Td2(n-1, k-1) - (n-2) * Td2(n-1, k);
end
end
Td2 = Td2(2:M+1, 2:M+1);
end
M= 3;
Td1 = compute_Td1(M);
disp('T_d^1:');
disp(Td1);
Td2 = compute_Td2(M);
disp('T_d^2:');
disp(Td2);
M= 5;
Td1 = compute_Td1(M);
disp('T_d^1:');
disp(Td1);
Td2 = compute_Td2(M);
disp('T_d^2:');
disp(Td2);
Td = kron(Td1,Td2);
disp('T_d:');
disp(Td);
T_d:
1 0 0 0 0 0 0 0 0
-1 1 0 0 0 0 0 0 0
2 -3 1 0 0 0 0 0 0
-1 0 0 1 0 0 0 0 0
1 -1 0 -1 1 0 0 0 0
-2 3 -1 2 -3 1 0 0 0
1 0 0 -2 0 0 1 0 0
-1 1 0 2 -2 0 -1 1 0
2 -3 1 -4 6 -2 2 -3 1
Using Kron is a suitable choice or not please explain is it possible to recreate Td as a function using cross product of Td1 and Td2 ?
1 Kommentar
But Td1 and Td2 are 5x5 matrices, as you've defined them. There is no such thing as a cross-product of 5x5 matrices.
Please give the necessary context and mathematical aims of this problem, so that it may be better understood.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Linear Algebra finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!