Why I can't run this coding?

1 次查看(过去 30 天)
Syazana
Syazana 2022-10-25
编辑: VBBV 2022-10-25
syms q1 t
%q1(t)
h=q1
q1_of_t=sym('q1(t)')
h1=subs(h,q1,q1_of_t)
%diff q1(t),diff twice q1(t)
diff_q1t=diff(h1,t);
diff_q1t2=diff(diff_q1t,t);
% t is for time
% q1_of_t=sym('q1(t)') - can't run in Matlab online but actually 3 years
% ago its can run in dowloaded matlab

采纳的回答

VBBV
VBBV 2022-10-25
syms q1(t) t
%q1(t)
h=q1
h(t) = 
q1_of_t=symfun('q1(t)',t)
q1_of_t(t) = 
h1=subs(h,q1,q1_of_t)
h1(t) = 
%diff q1(t),diff twice q1(t)
diff_q1t=diff(h1,t);
diff_q1t2=diff(diff_q1t,t)
diff_q1t2(t) = 
% t is for time
% q1_of_t=sym('q1(t)') - can't run in Matlab online but actually 3 years
% ago its can run in dowloaded matlab
  1 个评论
VBBV
VBBV 2022-10-25
编辑:VBBV 2022-10-25
use symfun
q1_of_t=symfun('q1(t)',t)
instead of
q1_of_t=sym('q1(t)')

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by