Matrix multiplication error using '.*'

2 ビュー (過去 30 日間)
AJ Woodson
AJ Woodson 2020 年 11 月 17 日
回答済み: Andrei Bobrov 2020 年 11 月 17 日
%so this is my simply code
r = randi(100,66);
t = (0:1/55:1);
e = exp(2*pi*i*13*t);
t = r.*e % this gives me error why is it and how can fix
  4 件のコメント
KSSV
KSSV 2020 年 11 月 17 日
You see r is a matrix and t is a array..this is what you want?
VBBV
VBBV 2020 年 11 月 17 日
@woodson then you have to divide t into 66. as
%if true
t = 0:1/65:1;
To get what you want.

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

回答 (3 件)

madhan ravi
madhan ravi 2020 年 11 月 17 日
t = linspace(0, 1, 66);
  1 件のコメント
AJ Woodson
AJ Woodson 2020 年 11 月 17 日
Thank you for the response ideally r is signl and e is a Doppler shift so matrix size would be 66x66 to explain further it would be like x = [2 4 5 2 3 5 6] x.*5 and output would be a x = [10, 20, 25 etc. ideal e in my case is just a scalar if I'm making myself clear where in the example r = x and e = 5

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


Walter Roberson
Walter Roberson 2020 年 11 月 17 日
randi(100,66) creates a 66 x 66 matrix of values 1 to 100.
0:1/55:1 is length 56.
When you .* a 66x66 matrix and a 1x56 matrix then what size of output are you expecting?
  1 件のコメント
AJ Woodson
AJ Woodson 2020 年 11 月 17 日
Thank you for the response ideally r is signl and e is a Doppler shift so matrix size would be 66x66 to explain further it would be like x = [2 4 5 2 3 5 6] x.*5 and output would be a x = [10, 20, 25 etc. ideal e in my case is just a scalar if I'm making myself clear where in the example r = x and e = 5

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


Andrei Bobrov
Andrei Bobrov 2020 年 11 月 17 日
r = randi(100,66);
t = reshape(0:1/55:1,1,1,[]);
e = exp(2*pi*i*13*t);
t = r.*e;

カテゴリ

Help Center および File ExchangeSignal Radiation and Collection についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by