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 个评论
更多回答(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!