How can I multiply two different sized objects?
조회 수: 1 (최근 30일)
이전 댓글 표시
%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?
댓글 수: 0
채택된 답변
madhan ravi
2019년 1월 8일
omega = linspace(-k*pi/A,k*pi/A,numel(t)); % change your line to this
댓글 수: 0
추가 답변 (1개)
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!