Mark point specific point on graph

조회 수: 1 (최근 30일)
Aaron Steffensmeier
Aaron Steffensmeier 2019년 10월 25일
답변: ag 2025년 3월 12일
g = input ('Precision of zero to the left ');
h = input ('Precision of zero to the right ');
x = (e:f:d);
z = (g:h);
y = a*x + b;
plot(y,x,'b*');
hold on
for x = (e:f:d)
y = a*x + b;
if y==z
plot (y(x)==z,'b*')
disp (x)
end
Im trying to plot any points within the range g and h these numbers are supposed to be very close to zero any help would be greatly appreciated

답변 (1개)

ag
ag 2025년 3월 12일
Hi Aaron,
To emphasize points that meet your specified condition in a plot, you can utilize a different marker.
The following code snippet illustrates how to achieve this:
% rest of the code
% Identify and plot points where y falls within the specified range
for i = 1:length(x)
if y(i) >= g && y(i) <= h % Adjust the condition according to your requirements
plot(x(i), y(i), 'ro', 'DisplayName', 'Points Near Zero'); % This will display the points with a red circle
disp(['x = ', num2str(x(i)), ', y = ', num2str(y(i))]);
end
end
Hope this helps!

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by