How to multiply n matrices

4 views (last 30 days)
Anwaya rath
Anwaya rath on 13 Jun 2017
Edited: Matt J on 13 Jun 2017
stepsize = 0.01;
time(1) = -10;
signalLength = 2000;
time(2) = 10;
N = signalLength+1;
x = time(1):stepsize:time(2);
Y = sech(x);
stem(x,Y), grid on
eigenevalue = [];
z = [];
k = (time(2)-time(1))/(N-1);
for n = 1 : N
eigenevalue = [eigenevalue time(1)+(n-1)*k];
z = [z i*exp(-1i*eigenevalue(n)*stepsize)];
d = z;
end
for n = 1 : N
M(:,:,n) = [z(n)^2 Y(n)*stepsize*z(n); -conj(Y(n))*stepsize*z(n) 1];
end
while N >= 2
s = mod(N,2);
N = (N-s)/2;
for n = 1 : (N-s),
M(:,:,n) = M(:,:,2*n-1).*M(:,:,2*n)';
end
if s ~= 0
M(:,:,N) = M(:,:,2*N-1);
end
end
A(:,:,1) = M(:,:,1);
The matrix M is a function of z and n. What I need is I have to multiply the matrix M N times to eliminate the variable n, and then substitute the value of z.Can anybody help me with this please?

Answers (0)

Community Treasure Hunt

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

Start Hunting!