フィルターのクリア

What does the period in line 20 ( after v)represent and why is it needed

21 ビュー (過去 30 日間)
Bob Meyes
Bob Meyes 2024 年 4 月 1 日 22:55
コメント済み: David Goodmanson 2024 年 4 月 1 日 23:44

採用された回答

David Goodmanson
David Goodmanson 2024 年 4 月 1 日 23:07
編集済み: David Goodmanson 2024 年 4 月 1 日 23:41
Hi Bob,
f is a vector with 1000 elements and consequently, so is the denominator. The dot allows matlab to divide each of the elements of the denominator into V, yieldiing a vector of length 1000 with the division done term-by-term.
In general to divide or multiply two vectors of equal length into each other term-by-term (either both are row vectors or both are column vectors), the dot is used:
c = a.*b or c = a./b
and if each vector is length n, so is the result. Here V is a scalar and not a vector, but in the special caseof a scalar, Matlab automatically does the element-by-element division anyway, using V as the numerator for every division.
When you start with independent variable x and want to create vector y = f(x), term-by-term using the dot is really common.
The same dot convention applies to matrices, where * indicates usual matrix multiplication and .* is term-by-term, and similar rules obtain for division, using / or \ and ./ or .\ For example
a = [1 2
3 4];
b = [5 6
7 8];
c = a*b
d = a.*b
c =
19 22
43 50
d =
5 12
21 32
  2 件のコメント
Bob Meyes
Bob Meyes 2024 年 4 月 1 日 23:10
What does f = logspace in my code mean/ do
David Goodmanson
David Goodmanson 2024 年 4 月 1 日 23:44
take a look at 'help logspace' and feel free to come back with comments if that help is not clear

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by