Plotting a function over an interval
Afficher commentaires plus anciens
Hi,
I'm dealing with defining a function and then plotting it. The function is y1= arctan(exp(x)*(x-1))+ pi/2 which I need to plot it over interval x=0:0.1:2 , but every time I get an error. What do I need to do?
I did this:
x = 0:.01:2;
y1= arctan(exp(x)*(x-1))+ pi/2
plot(x,y1)
Also, if I want to have several functions plotted in a same window but with different colors, what should I do?
Réponse acceptée
Plus de réponses (2)
Kris Hoffman
le 29 Nov 2020
Tought I'd add to this answer.
y1 = @(x) atan(exp(x).*(x-1))+ pi/2
fplot(y1,[0,2])
1 commentaire
Fernando Baltazar
le 20 Avr 2022
This worked for me thanks!
Fangjun Jiang
le 27 Sep 2011
You mean this?
x = 0:.01:2;
y1= atan(exp(x).*(x-1))+ pi/2;
plot(x,y1);
help plot for details.
plot(x1,y1,'r',x2,y2,'g',x3,y3,'b')
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!