How to element wise exponential of a matrix

93 ビュー (過去 30 日間)
Titas Deb
Titas Deb 2019 年 8 月 30 日
編集済み: Titas Deb 2019 年 8 月 31 日
How do I take the element-wise exponential of a matrix which looks like:
dy =
Columns 1 through 9
15.7800 31.5600 47.3400 63.1200 78.9000 94.6800 110.4600 126.2400 142.0200
Columns 10 through 18
157.8000 173.5800 189.3600 205.1400 220.9200 236.7000 252.4800 268.2600 284.0400
Columns 19 through 24
299.8200 315.6000 331.3800 347.1600 362.9400 378.7200
If I do exp(dy)
it's only giving me a set of zeros.
Please help.

採用された回答

David Goodmanson
David Goodmanson 2019 年 8 月 30 日
編集済み: David Goodmanson 2019 年 8 月 30 日
Hi Titas,
dy =
Columns 1 through 10
15.7800 31.5600 47.3400 63.1200 78.9000 94.6800 110.4600 126.2400 142.0200 157.8000
Columns 11 through 20
173.5800 189.3600 205.1400 220.9200 236.7000 252.4800 268.2600 284.0400 299.8200 315.6000
Columns 21 through 24
331.3800 347.1600 362.9400 378.7200
z = exp(dy)
z =
1.0e+164 *
Columns 1 through 10
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Columns 11 through 20
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Columns 21 through 24
0.0000 0.0000 0.0000 2.9923
It's a display issue. The numbers have such a wide range that only the last one, the largest, shows up in the default format. But if you look at them separately, the correct values are there:
z(1)
ans = 7.1313e+06
A good solution is format g:
format short g
z =
Columns 1 through 8
7.1313e+06 5.0855e+13 3.6266e+20 2.5862e+27 1.8443e+34 1.3152e+41 9.3793e+47 6.6886e+54
Columns 9 through 16
4.7698e+61 3.4015e+68 2.4257e+75 1.7298e+82 1.2336e+89 8.797e+95 6.2734e+102 4.4737e+109
Columns 17 through 24
3.1903e+116 2.2751e+123 1.6225e+130 1.157e+137 8.251e+143 5.884e+150 4.196e+157 2.9923e+164
  2 件のコメント
Titas Deb
Titas Deb 2019 年 8 月 30 日
編集済み: Titas Deb 2019 年 8 月 31 日
Thanks a lot. Is there any way to resolve that? I have a bunch of calculations to do on top of exponential on this matrix.
David Goodmanson
David Goodmanson 2019 年 8 月 31 日
I'm not sure what you mean, because none of them are zeros. They look like a vector of zeros (except for the last one) when they are displayed in the conventional format. But none of them are stored as zero, as indicated by format short g.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by