I am getting some error in matrix multiplication. Kindly help me in this regard.

Following is my code.
c=zeros(64,64,33);
for i=1:64
for j=1:64
for k=1:33
y=reshape(V(i,j,k,:),240,1); %The size of y will be 240*1
c(i,j,k)=(transpose(A)*A)\transpose(A)*y;
end
end
end
By doing so I am getting error, at c(i,j,k)=(transpose(A)*A)\transpose(A)*y;
The error statement is
Assignment has more non-singleton rhs dimensions than non-singleton
subscripts
Kindly help !!!

2 comentarios

Thanks a lot Walter Roberson. I got the way to do it.
Humble Regards :) (y)

Iniciar sesión para comentar.

Respuestas (1)

If y is of size 240x1, than the result of (transpose(A)*A)\transpose(A)*y will be of the same size. You cannot assign a vector to a single scalar
c(i,j,k)
Instead, use
c(i,j,k,:)=(transpose(A)*A)\transpose(A)*y;

1 comentario

Thanks a lot dear :). I understand the mistake. The size of (transpose(A)*A)\transpose(A)*y is 3*1. a lot of thanks for your kind response

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 6 de Oct. de 2015

Comentada:

el 6 de Oct. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by