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
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);
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!