Make MATLAB plot all points?

1 view (last 30 days)
Jala Douglas
Jala Douglas on 5 Oct 2018
Edited: Jala Douglas on 5 Oct 2018
How do I tell MATLAB to plot all points for a certain range of x OR certain range of y? I am trying to write a script that finds all points with a given value of a variable 'deltat' Here is my script:
% Position starting: at 0 seconds.*
hold on; % Keeps previous point.*
t2=plot(5,0,'bx') % Position ending: at 5 seconds
p=plot(8,6,'o');
%%Plot Aesthetics
% Identify axis limits.*
xlim([-1 10]);
ylim([-3 10]);
% Label Points
txt = '\leftarrow t1';
text(0,0,txt);
txt2 = '\leftarrow t2';
text(5,0,txt2);
xlabel('Time (seconds)');
title('Delta Theta');
plot([0,8],[0,6],'k--') % plots line w/ formula plot([x1,x2],[y1,y2])
plot([5,8],[0,6],'k--')
ts=atand(6/8); %angle t1 in degrees
tf=atand(6/3);
deltat=(tf-ts)/(5-0);
%%Everything generic
xd=get(p,'XData') % This tells MATLAB to grab the x-component of 'p'
tss=atand(((get(p,'YData')-get(t1,'YData')))/((get(p,'XData')-get(t1,'XData'))));
tff=atand(((get(p,'YData')-get(t2,'YData')))/((get(p,'XData')-get(t2,'XData'))));
deltatt=((tff-tss)/((get(t2,'XData'))-(get(t1,'XData'))));
As you can see, 2 (t1 and t2) are constant, but how do I change the script to make point 'p' any point in space?

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!