How to add a result on a plot.
조회 수: 2 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
KL
2017년 11월 27일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!