Azzera filtri
Azzera filtri

centering a graph at the origin point

4 visualizzazioni (ultimi 30 giorni)
Holden Earl
Holden Earl il 17 Apr 2020
Modificato: darova il 17 Apr 2020
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 Commenti
Tommy
Tommy il 17 Apr 2020
Modificato: Tommy il 17 Apr 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);
Holden Earl
Holden Earl il 17 Apr 2020
ahhh okay thanks, you're a lifesaver!

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by