Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

how to multiply matrix 2 * 2 if the elements of the matrix are row vectors.

2 visualizaciones (últimos 30 días)
Ed
Ed el 15 de Jul. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
fre=100:100:1000;
A=[1 9; 9 5]; % matrix 2*2
B=[1 0; cos(2.*pi.*fre) 0]; %matrix 2*2
C=A.*B; % ?? how ?? or
%C=A*B; % ???
% i need know who the elements of C
disp(C);

Respuestas (3)

Honglei Chen
Honglei Chen el 15 de Jul. de 2013
B=[1 0; cos(2.*pi.*fre) 0];
will error out since it is not a 2x2 matrix. You will have to use a cell because fre is a vector. You may need to do it with cell arrays if this is what you want
a = rand(2)
b = {1 2;[3 5] 4}
c = cellfun(...
@times,b,arrayfun(@(x)x,a,'UniformOutput',false),'UniformOutput',false)

Andrei Bobrov
Andrei Bobrov el 16 de Jul. de 2013
fre=100:100:1000;
b = [1 0;0 0];
B = repmat(b,1,1,numel(fre));
B(2,1,:) = cos(2.*pi.*fre);
A=[1 9; 9 5];
C1 = bsxfun(@times,A,B); % times
C2 = reshape(A*reshape(B,2,[]),size(A,1),size(A,2),[]); % mtimes

Ed
Ed el 16 de Jul. de 2013
thanks .. I will review the information

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by