How to plot function(s) with smooth curves

6 ビュー (過去 30 日間)
Timothy Cha
Timothy Cha 2019 年 9 月 9 日
回答済み: Star Strider 2019 年 9 月 9 日
I am trying to plot three different equations onto one figure, and each equation with a smooth curve. Because I need to set the values of the independent variable, I cannot figure out how to make them into smooth curves; instead the graphs are segmented, from point to point. Any tips are greatly appreciated!
Here is my code:
N = 0:0.2:1
f = @(N) N.*(1-N);
g = @(N) N.^(2/3)-N
h = @(N) -N.*log(N)
plot(N, f(N), N, g(N), N, h(N))
Which gives me this figure:
Screen Shot 2019-09-08 at 11.07.07 PM.jpg
While this is the figure I want:
Screen Shot 2019-09-08 at 11.07.26 PM.jpg

採用された回答

Star Strider
Star Strider 2019 年 9 月 9 日
N = linspace(0, 1);
This will produce a vector of 100 points between 0 and 1. See the documentation on linspace for details and other options.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by