필터 지우기
필터 지우기

MATLAB Symbolic math toolbox

조회 수: 1 (최근 30일)
Blake Sewell
Blake Sewell 2020년 10월 14일
댓글: Ameer Hamza 2020년 10월 14일
Hi, I am having troubles with using the symbolic math toolbox to figure out the following:
I have code which doesnt use the symbolic math toolbox which gets the correct graph and also code which attempts to use the symbolic math toolbox but does not work:
Working code without symbolic toolbox:
t = 1:1:10;
s = ((6/5).*(t.^3)-(81/5).*(t.^2)+(252/5).*(t));
velocity = diff(t); %first derivative is velocity
%d/dx of s = 3.6t^2-32.4t+50.4
plot (s)
xlabel('Time (seconds)');
ylabel('Displacement (metres)');
%turning point @ (5,-22.2) on graph
%roots=turning point
p = [3.6 -32.4 50.4];
r = roots(p);
disp (r)
Non-working code using symbolic math toolbox:
syms t
s = sym(6/5).*(t.^3)-(81/5).*(t.^2)+(252/5).*(t);
v = diff(s); %first derivative is velocity
%d/dx of s = 3.6t^2-32.4t+50.4
fplot (t,v)
xlim([0 10])
ylim([-50 100])
xlabel('Time (seconds)');
ylabel('Displacement (metres)');
%turning point @ (5,-22.2) on graph
%roots=turning point
p = [3.6 -32.4 50.4];
r = roots(p);
disp (r)
If anyone can assist me in altering the non-working code to achieve the same graph as the working code, that would be greatly appreciated!!

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 10월 14일
편집: Ameer Hamza 2020년 10월 14일
fplot() line should be like this
fplot (v, [0 10])
The rest is correct.
  댓글 수: 4
Blake Sewell
Blake Sewell 2020년 10월 14일
Thankyou, appreciate the help!
Ameer Hamza
Ameer Hamza 2020년 10월 14일
I am glad to be of help!!!

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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by