need help with basic speed time graph plot

조회 수: 5 (최근 30일)
Ben Newton
Ben Newton 2019년 11월 5일
댓글: Rena Berman 2019년 12월 12일
need to make a subplot for this speed equation over 0 to 8 seconds, but all i get is a blank graph. i think its because the graph is zoomed in on a specific area, any idea how to plot one that can be seen??
t = 0:0.05:8;
s = @(t)((0.0041*t^6) - (0.1383*t^5) + (1.6963*t^4) - (8.915*t^3) + (13.961*t^2) + (40.96*t))/2.237;
subplot(1,2,1)
plot(t,s(t))
title('speed vs time')
xlabel('time (Seconds)')
ylabel('speed (m/s)')
grid on;
  댓글 수: 2
Stephen23
Stephen23 2019년 11월 8일
Original question:
need to make a subplot for this speed equation over 0 to 8 seconds, but all i get is a blank graph. i think its because the graph is zoomed in on a specific area, any idea how to plot one that can be seen??
t = 0:0.05:8;
s = @(t)((0.0041*t^6) - (0.1383*t^5) + (1.6963*t^4) - (8.915*t^3) + (13.961*t^2) + (40.96*t))/2.237;
subplot(1,2,1)
plot(t,s(t))
title('speed vs time')
xlabel('time (Seconds)')
ylabel('speed (m/s)')
grid on;
Rena Berman
Rena Berman 2019년 12월 12일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

채택된 답변

Richard Brown
Richard Brown 2019년 11월 5일
Your function needs to have elementwise powers, i.e. use .^ instead of ^
It's trying to do matrix powers of the vector of time values, which doesn't make sense.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by