how can I display text of zero amplitude with text message

1 Ansicht (letzte 30 Tage)
Muhammad Ali Raza
Muhammad Ali Raza am 25 Mär. 2023
Kommentiert: Walter Roberson am 26 Mär. 2023
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 ?

Antworten (1)

Walter Roberson
Walter Roberson am 26 Mär. 2023
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 Kommentar
Walter Roberson
Walter Roberson am 26 Mär. 2023
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

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by