Make MATLAB plot all points?

1 vue (au cours des 30 derniers jours)
Jala Douglas
Jala Douglas le 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?

Réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by