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.

采纳的回答

Star Strider
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
Star Strider 2020-10-8
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile 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!

Translated by