フィルターのクリア

Why do I get wrong results with power of 2?

1 回表示 (過去 30 日間)
Reinhard Palaver
Reinhard Palaver 2016 年 8 月 9 日
コメント済み: Reinhard Palaver 2016 年 8 月 10 日
I want to power a scalar with a matrix-values, which seems to be 2. As a result I get -2,53.
For example: my scalar = 1.61803 one of the matrixvalues = 2 result = -2.53
But if the matrix value = 3 the result is correct with 4.24
The matrix values were beeing created by following formula:
x = log10(factor)/log10(1.61)
Whats wrong with the 2? Maybe it's a problem of floating point numbers?
kind regards Reinhard

回答 (1 件)

Thorsten
Thorsten 2016 年 8 月 9 日
Use .^
M = [1 2; 3 4]; 1.61803.^M
  1 件のコメント
Reinhard Palaver
Reinhard Palaver 2016 年 8 月 10 日
Hi Thorsten!
I've also used .^! But this is not the solution. In the meantime I've found the answer. The problem is the floating point number after computing the x. I changed the basic formula to
x = real(log10(factor)/log10(1.61))
so it works. But thanks for answering!

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by