Function 'subs' different output for a (similar?) input
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Bobby Fischer
il 18 Gen 2021
Risposto: Divija Aleti
il 25 Gen 2021
clc
syms F(t)
F(t)=[-5*cos(2*t) -5*sin(2*t) 3*exp(2*t);
-2*(cos(2*t)+sin(2*t)) 2*(cos(2*t)-sin(2*t)) 0;
cos(2*t) sin(2*t) exp(2*t)]
invF=inv(F);
t=0;
invF0=subs(invF(t)) % Here
syms t
expAt=F(t)*invF0
DexpAt=diff(expAt)
t=0;
DexpA0=subs(DexpAt) % Here
% if I did this instead: DexpA0=subs(DexpAt(t)) gives error
% but if I do it above doesn't give error. Why?
0 Commenti
Risposta accettata
Divija Aleti
il 25 Gen 2021
Hi Bobby,
syms F(t)
The above command implies that 'F' is a symbolic function. Hence, the command
invF0=subs(invF(t))
does not give error.
However, 't' is defined as a symbolic variable, and so, 'DexpAt' is also a symbolic variable. As variables cannot take any input arguments, the below command gives an error.
DexpA0=subs(DexpAt(t))
For the above command to run without any error, you can define 'DexpAt' also as a symbolic function by changing
DexpAt=diff(expAt)
to
DexpAt(t)=diff(expAt)
You can check your workspace to confirm if any symbol is a symbolic function or a symbolic variable.
For additional information on symbolic variables and functions, refer to the following link:
Regards,
Divija
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Special Values in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!