Do you have code to find the location of the zeros?
how can I display text of zero amplitude with text message
1 view (last 30 days)
Show older comments
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 ?
Answers (1)
Walter Roberson
on 26 Mar 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 Comment
Walter Roberson
on 26 Mar 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
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!