Everything being the same, then why does matrix C give different values in the two codes?
    9 次查看(过去 30 天)
  
       显示 更早的评论
    
All the values are the same in both the codes, then why does matrix C give different values in both the codes?
code1:
u=[30 50 110];
M=10; 
N=4;  
K=3;  
d=0.5;
fn=@(u,k) exp(1j*2*pi*d*(0:k-1).' * sind(u));
A=fn(u,M);
B=fn(u,N);
C=kron(B,A);
code2
u=[30 50 110];
M=10; 
N=4;  
K=3;  
d=0.5;
C = STM(u,M,N,d);
function C = STM(u,M,N,d)
    A=exp(1j*2*pi*d*(0:M-1).'*sind(u));
    B=exp(1j*2*pi*d*(0:N-1).'*sind(u));
    C = zeros(size(A, 1)*size(B, 1), length(u));
    for idxK = 1 : 1 : length(u)
        C(:, idxK) = kron(B(:, idxK), A(:, idxK));
    end
end
0 个评论
回答(1 个)
  Cris LaPierre
    
      
 2021-10-16
        Because they are not the same?
Your output should be [size(A, 1)*size(B, 1), size(A, 2)*size(B, 2)]
3 个评论
  Cris LaPierre
    
      
 2021-10-16
				Then you misunderstand what the Kroeneker Tensor Product is.
C is a 40x9 matrix in your first code.
u=[30 50 110];
M=10; 
N=4;  
K=3;  
d=0.5;
fn=@(u,k) exp(1j*2*pi*d*(0:k-1).' * sind(u));
A=fn(u,M);
B=fn(u,N);
C=kron(B,A)
size(C)
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

