How do i define a variable as a function?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hamza Yusuf
le 11 Oct 2021
Commenté : Star Strider
le 11 Oct 2021
Let us say there is a fucntion theta that is depedent on time: Theta(t); It is in a cos function so: cos(theta(t))
How do i differentiate this in matlab so it uses the chain rule?
clear all
syms t theta
theta=t;
f=cos(theta(t));
diff(f,t)
I have tried the above and got the errors:
Error using sym/subsref (line 49)
Error using maplemex
Error, (in MTM:-subsref) indices must be positive integers, got t
Error in test (line 5)
f=cos(theta(t));
0 commentaires
Réponse acceptée
Star Strider
le 11 Oct 2021
I suspect this works the similiarly in Maple (that I do not currently have) —
syms t theta(t)
f=cos(theta(t));
dfdt(t) = diff(f,t)
.
7 commentaires
Star Strider
le 11 Oct 2021
I hope that you do not have to uninstall Maple, and can simply disconnect it from MATLAB.
However if you need to uninstall it (and then reinstall it without connecting it to MATLAB next time), and since it appears that you are using Windows, open Control Panel, then click on Programs and Features, then follow the instructions. Then, reinstall Maple without connecting it to MATLAB.
.
Plus de réponses (1)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!