Cannot make vektor of exp(x)/(exp(x) 1)
2 ビュー (過去 30 日間)
古いコメントを表示
Christian Christiansen
2019 年 10 月 13 日
回答済み: Ekemini Stephen
2019 年 10 月 13 日
I am trying to make a plot of the funktion f(x)=exp(x)/(exp(x)+1)
This is how I tried to do it:
x = [0:0.1:2];
y1 = exp(x)/(exp(x)+1);
plot(x, y1)
But for some reason I only get one value in y1.
I have tried changing the the funtion to something else, and it works fine.
I have tried to see if I wrote the function wrong by simply checking different numbers between 0 and 2 and it works fine.
2 件のコメント
dpb
2019 年 10 月 13 日
Look up the "dot" operators for element-by-element operation instead of matrix operations...
"./" insread of "/"
採用された回答
Ekemini Stephen
2019 年 10 月 13 日
Hi, check this code out, its the correct code.
%% YOUR CORRECT CODE
x = 0:0.1:2;
y1 = exp(x)./(exp(x)+1);
figure
plot(x,y1,'r--o','LineWidth',2)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!