Equation of the Line in command window
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a graph, with an equation, but i need to display that equation into the command window.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/375361/image.jpeg)
댓글 수: 0
채택된 답변
Star Strider
2020년 10월 8일
Try this:
B = [y(:) ones(size(y(:)))] \ x(:);
fprintf('Linear: y = %.4f*x%+.2f', B) % Display In Command Window
text(0, max(ylim), sprintf('Linear: y = %.4f*x%+.2f', B), 'HorizontalAlignment','left', 'VerticalAlignment','top') % Display On Plot
.
댓글 수: 4
Star Strider
2020년 10월 8일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!