Matrix Multiplication is possible???

1 回表示 (過去 30 日間)
Marwen
Marwen 2013 年 8 月 15 日
Hi Can i programm under matlab Matrix multiplication generally without use of general entries
C = A*B is the linear algebraic product of the matrices A and B. If A is an m-by-p and B is a p-by-n matrix
Thanks

回答 (4 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 15 日
  1 件のコメント
Andrew Reibold
Andrew Reibold 2013 年 8 月 15 日
lol, so complicated!

サインインしてコメントする。


Image Analyst
Image Analyst 2013 年 8 月 15 日
What are "general entries"? If you want the matrix multiplication, simply do C=A*B like you said. If you want element-by-element multiplication, do C=A.*B. So I'm not sure what you're asking. Did you actually try C=A*B like you said - it's easy enough to do. If so, was there something unexpected that you observed?

Marwen
Marwen 2013 年 8 月 15 日
Hi I develop simples examples like that A = [ 1 2 3; 4 5 6] B = [-5 8 11; 3 9 21;4 0 8] C=A*B
and enter i and j manually I hope you understand me
Thanks dear
  3 件のコメント
Marwen
Marwen 2013 年 8 月 15 日
編集済み: Azzi Abdelmalek 2013 年 8 月 15 日
Hi Image analyste,
I want to develop something like that with Matlab :
nt A[50][50];
printf("Donner le nombre des lignes de la matrice A\n");
scanf("%d",&l);
printf("Donner le nombre des colonnes de la matrice A\n");
scanf("%d",&c);
printf("Enter les elements de la matrice A\n");
for(i=0;i<l;i++)
for(j=0;j<c;j++)
{
printf("Enter la valeur de A[%d][%d] ",i,j);
scanf("%d",&A[i][j]);
printf("\n");
}
i wish i clear my question thks
Image Analyst
Image Analyst 2013 年 8 月 15 日
OK. I'm going to assume that the code you gave does what you want to do. I still don't see a question here, so I guess we're done.

サインインしてコメントする。


Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 15 日
編集済み: Azzi Abdelmalek 2013 年 8 月 15 日
A=randi(10,5,6); % Example
B=randi(10,6,7);
p=size(A,2);
C=@(i,j) sum(A(i,:)'.*B(:,j))
% If i=2 and j=6 use
C(2,6)
Which is the same as
C=A*B
C(2,6)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by