How can I multiply two different sized objects?

1 回表示 (過去 30 日間)
Florea George
Florea George 2019 年 1 月 8 日
回答済み: madhan ravi 2019 年 1 月 8 日
%Matrix dimensions must agree.
A = 1;
pas = 1/1000;
t=-10:pas:10;
k=10;
omega = -k*pi/A:1/10:k*pi/A;
x=omega.*t;
%The error appears on the last line where x is. how can i multiply them?

採用された回答

madhan ravi
madhan ravi 2019 年 1 月 8 日
omega = linspace(-k*pi/A,k*pi/A,numel(t)); % change your line to this

その他の回答 (1 件)

Totanly
Totanly 2019 年 1 月 8 日
you can't multiply two different sized vectors. Follow the matrix multiplication rules.
if A=first matrix and B=second matrix
size(A) should be Size(B) for element by element multiplication;
no of columns of A= no of rows of B for matrix multiplication
  1 件のコメント
Florea George
Florea George 2019 年 1 月 8 日
and how i can adapt this theory to my problem?

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by