Info
This question is closed. Reopen it to edit or answer.
Trying to solve a simple matrix multiplication operation but getting a single error.
1 view (last 30 days)
Show older comments
M2N.m:
% 1D PSHT Matlab code
function M=M2N(n)
n=2;
B=4;
if n==1
M=eye(2);
else
p=2^(n-1)-2; m=2^(2*n-2);
a=sqrt(3*m/(4*m-B)) ; b=sqrt((m-B)/(4*m-B));
M=[[1 0; 0 b] zeros(2,p) [0 0; a 0] zeros(2,p);
zeros(p,2) eye(p) zeros(p,2) zeros(p,p);
[0 0 ; 0 a] zeros(2,p) [0 1 ;-b 0] zeros(2,p);
zeros(p,2) zeros(p,p) zeros(p,2) eye(p)];
end
end
psht.m:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Y=psht()
n=2;
for i=1:n
Y=kron(eye(2^(n-i)),M2N(i))* kron(eye(2^(n-i)),kron(hadamard(2),eye(2^(i-1))))*Y;
end
end
5 Comments
Walter Roberson
on 13 Jun 2019
Your code works fine for me in R2019a.
What is the complete error message? And also which MATLAB release are you using?
In particular are you using R2016a or earlier?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!