How to plot function(s) with smooth curves
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Timothy Cha
il 9 Set 2019
Risposto: Star Strider
il 9 Set 2019
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:

While this is the figure I want:

0 Commenti
Risposta accettata
Star Strider
il 9 Set 2019
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Interpolation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!