beginner questions about symbols used in formula

42 ビュー (過去 30 日間)
Frank
Frank 2014 年 2 月 4 日
回答済み: Amit 2014 年 2 月 4 日
sample./(sqrtvar(:,ones(n,1))
What does the full stop and the colon do in the above formula?

回答 (1 件)

Amit
Amit 2014 年 2 月 4 日
The fullstop (.) operator is for element-wise operation. For example:
A = [1 2 3 4];
B = [5 6 7 8];
AS you can see that A and B both are 1X4 matrices and normal matrix multiplication can not be done. However, lets say you want an output C as [1*5 2*6 3*7 4*8] (i.e. multiply each element with the corresponding element), then you can do
C = A.*B;
The colon operator (:) is a way to write 1:end. In the example here, to access all the element of A, you can write:
A(1,1:4)
A(1,1:end)
or A(1,:)
All 3 a legit way to do this and will give same result.

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by