how can I display text of zero amplitude with text message

조회 수: 1 (최근 30일)
Muhammad Ali Raza
Muhammad Ali Raza 2023년 3월 25일
댓글: Walter Roberson 2023년 3월 26일
I have code below
t = -4:0.1:4;
y = t.^3-10*t;
plot(t,y)
when I run it the waveform displayed like below. how can I display the zero amplitude by using text command ?

답변 (1개)

Walter Roberson
Walter Roberson 2023년 3월 26일
After having found the places that are zeros and storing the x coordinates in List_of_XCoordinates_Of_Zeros then
for xcoord = reshape(List_of_XCoordinates_Of_Zeros,1,[])
text(xcoord, 0, "X = " + round(xcoord,2));
end
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 3월 26일
syms t
eqn = 3*t.^5-10*t^3+5;
List_of_XCoordinates_Of_Zeros = double(vpasolve(eqn));
List_of_XCoordinates_Of_Zeros(imag(List_of_XCoordinates_Of_Zeros) ~= 0) = [];
fplot(eqn, [-2 2])
for xcoord = reshape(List_of_XCoordinates_Of_Zeros,1,[])
text(xcoord, 0, "X = " + round(xcoord,2));
end

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by