Borrar filtros
Borrar filtros

How to add a result on a plot.

2 visualizaciones (últimos 30 días)
Alexandros Anastasakos
Alexandros Anastasakos el 27 de Nov. de 2017
Comentada: KL el 27 de Nov. de 2017
I have made a program that calculates the root of a function. I want to have text saying "the root of the function is at x=(result calculated by program) on the plot. I am using the text command to print the message where I want but I don't know how to print the result itself on plot. Can someone help me?

Respuesta aceptada

KL
KL el 27 de Nov. de 2017
use num2str to convert the result to string and use it inside text command,
text(x_pos, y_pos, ['the root of the function is at x = ', num2str(result)])
  2 comentarios
Alexandros Anastasakos
Alexandros Anastasakos el 27 de Nov. de 2017
Thank you. I realize this is a pretty basic question but i am a beginner and couldn't really work it out myself.
KL
KL el 27 de Nov. de 2017
You're welcome, glad to help.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by