필터 지우기
필터 지우기

How to display the equation in the graph.Here the slope is found to be 0.35(if i am not wrong) and i want to display the equation as y=0.35x on the graph .Any answers will be highly appreciated

조회 수: 1 (최근 30일)

채택된 답변

Mohammad Sami
Mohammad Sami 2020년 5월 4일
There are two options.
First option is to use the text function to display the text on the axis.
x = -1;
y = -0.5;
text(x,y,'y = 0.35x');
The other option is to use annotations.
x = [0.3 0.5]; % normalized coordinates
y = [0.6 0.5]; % normalized coordinates
annotation('textarrow',x,y,'String','y = 0.35x ')
  댓글 수: 3
Mohammad Sami
Mohammad Sami 2020년 5월 4일
편집: Mohammad Sami 2020년 5월 4일
you can get the coefficient programatically and convert it to a string.
formula = sprintf('y = %0.4fx',m.Coefficients.Estimate(1));
text(x,y,formula);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by