square root on an interval

how to make a figure of the square root on the interval [0,2]. The figure should be smooth, not angular?

Respuestas (1)

Ameer Hamza
Ameer Hamza el 8 de Nov. de 2020

1 voto

One way is to use fplot()
f = @(x) sqrt(x)
fplot(f, [0 2])

4 comentarios

Jens Petit-jean
Jens Petit-jean el 8 de Nov. de 2020
thanks, but why do you use the @ in front of (x)?
Ameer Hamza
Ameer Hamza el 8 de Nov. de 2020
This creates a function handle. Read about function handle here: https://www.mathworks.com/help/matlab/function-handles.html
Jens Petit-jean
Jens Petit-jean el 8 de Nov. de 2020
okay thank you very much!
Ameer Hamza
Ameer Hamza el 8 de Nov. de 2020
I am glad to be of help!!!

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Preguntada:

el 8 de Nov. de 2020

Comentada:

el 8 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by