centering a graph at the origin point

4 次查看(过去 30 天)
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 个评论
Tommy
Tommy 2020-4-17
编辑:Tommy 2020-4-17
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 2020-4-17
ahhh okay thanks, you're a lifesaver!

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by