Matrix multiplication error using '.*'

%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

Are you looking for this?
%so this is my simply code
t = (0:1/55:1);
r = randi(size(t));
e = exp(2*pi*i*13*t);
t = r.*e % this gives me error why is it and how can fix
AJ Woodson
AJ Woodson 2020년 11월 17일
No this does not help because I want to do .* to a continious wave as well so size(t) will not work for all my cases.
KSSV
KSSV 2020년 11월 17일
You see r is a matrix and t is a array..this is what you want?
@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일

0 개 추천

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일

0 개 추천

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일

0 개 추천

r = randi(100,66);
t = reshape(0:1/55:1,1,1,[]);
e = exp(2*pi*i*13*t);
t = r.*e;

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

질문:

2020년 11월 17일

답변:

2020년 11월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by