matlab- syntax question

Hi,
   I saw a following matlab code. there is a "." (dot) after "w1". what is the meaning of that dot? I try to remove it, and I don't see any different in the result.

w1=0.5*pi;
td=0:ts:4;
x_sin=sin(w1.*td);
plot (x_sin)
hsuyfAsked:
Who is Participating?
 
dbkrugerCommented:
In matlab,* is matrix multiplication.

so:

a=[1 2 3]; % row vector
b = [1;2;3]; % column vector

b*a =
  1  *  *
  *  4  *
  *  *  9

I'm not going to write it out, but you get the picture.

If you just want to multiply the first element of a times b, the second, etc. then use .*

b.*a = [1 4 9]
0
 
hsuyfAuthor Commented:
thank you very much!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.