centering a graph at the origin point
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
all of my graphs for some reason will start at some arbitrary number like 300 and not show my graph. the one i am trying to plot is kind of complex so i tried it with a simple line and it still wouldnt work but this is the code im trying to plot.(there might be a mistake with my code but even the simple plots wont work )
v0 = (125/3.6);
g = 9.81;
t = 7.4535;
h = 60.4972;
theta = (pi/0.1944);
x = v0*t*cos(theta);
y = h - ((g*t.^2)*1/2)+(v0*t*sin(theta));
plot(x,y);
2 commentaires
Tommy
le 17 Avr 2020
Modifié(e) : Tommy
le 17 Avr 2020
Every variable in your code is a scalar, including x and y. When you call plot using scalars, no line will be plotted, and you will only see the value if you specify a marker, like 'o':
v0 = (125/3.6);
g = 9.81;
t = 7.4535;
h = 60.4972;
theta = (pi/0.1944);
x = v0*t*cos(theta);
y = h - ((g*t.^2)*1/2)+(v0*t*sin(theta));
plot(x,y,'o');
To plot a line, x and y need to contain multiple elements. For example,
v0 = (125/3.6);
g = 9.81;
t = linspace(1,7.4535,100);
h = 60.4972;
theta = (pi/0.1944);
x = v0*t*cos(theta);
y = h - ((g*t.^2)*1/2)+(v0*t*sin(theta));
plot(x,y);
Réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!