Right now I am trying to recreate an equation using MATLAB, but I am seeing some discrepancies between the solution I got from the calculator and the MATLAB.
This is the equation I am trying to recreate in MATLAB: with n being a matrix. The code I've written for this equation in MATLAB looks like this:
y = 1/1+exp(-n)
So for example if I am trying to find y with n = , my expected answer should be = [0.99; 0.12; 0.00012] but in MATLAB I am getting:
y =
1.0e+03 *
0.0010
0.0084
8.1041
which is obviously not what I want. I am certain it's a simple mistake, but I can't figure it out. What am I doing wrong? How can I fix this?

 採用された回答

Walter Roberson
Walter Roberson 2019 年 11 月 11 日

0 投票

y = 1./(1+exp(-n))

1 件のコメント

May
May 2019 年 11 月 11 日
Thank you very much! I tried ./ and () each by themselves before but it never occured to me to do them together at the same time. Really, thank you very much!!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics and Optimization についてさらに検索

質問済み:

May
2019 年 11 月 11 日

コメント済み:

May
2019 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by