Hello! I am need help with this code I am creating. The object is to read from a file with variables horizontal (horizontal axis data) and vertical (vertical axis data). I can't seem to figure out how to indicate the minimum point with a red open circle and the max point with a green open circle. Another problem with this program I am having is when I display my results of my min and max data information, I have a data point that comes out in the four hundreds. Our graph being displayed is from -2 to 4 on the horizontal (x) axis and -8 to 8 on the vertical (y) axis. The following is my code:
clear all
file_to_read = input('Enter file to read >>','s');
load(file_to_read)
minimum_value = min(horizontal);
minimum_value_index = find(horizontal == minimum_value);
maximum_value = max(vertical);
maximum_value_index = find(vertical == maximum_value);
figure(1)
plot(horizontal, vertical, 'k-')
axis([-2 4 -8 8])
set(gca, 'XTick', [-2:0.5:4])
set(gca, 'YTick', [-8:1:8])
grid on
xlabel('Input')
ylabel('Output')
title ('Input and Output of a System')
disp(['The minimum value is ', num2str(minimum_value_index),...
', which occurs at ' num2str(minimum_value), '.'])
disp(['The maximum value is ', num2str(maximum_value_index),...
', which occurs at ' num2str(maximum_value), '.'])