How to write a mathematical function in MATLAB?
96 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Swati Sarangi
am 4 Nov. 2020
Kommentiert: Swati Sarangi
am 5 Nov. 2020
Hi All,
I want to write velocity vector in terms of its component in x, y and z direction , say V= V(t)_x i^+V(t)_y j^+V(t)_z k^. These components are functions of time.
Then I want to differentiate that function with respect to time.
How to do that ?
Any suggestion will be appreciated!
Thanks in advance.
3 Kommentare
Akzeptierte Antwort
VBBV
am 4 Nov. 2020
Bearbeitet: VBBV
am 4 Nov. 2020
%if true
% code
% end
syms t i j k
vx = t^2;
vy = t^3;
vz = t^4;
V = @(t) vx*i+vy*j+vz*k;
VV = diff(V,t);% differentiate
Use symbolic expressions and diff function
1 Kommentar
Walter Roberson
am 4 Nov. 2020
no the i^ and so on indicate different unit vectors along different axes.
You probably need to introduce new symbolic variables to stand in for the components, and add logic to handle raising them to various powers using mapSymType.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!