Hi, I am a beginner and I am learning symbolic math toolbox for MATLAB.
I have got a system of differential equations
and a definition for alpha:
where r = √(x^2 +y^2 +z^2).
My aim is to differentiate alpha with respect to t, and then substitute the differential equations to obtain
My code looks like this:
syms alpha(t) beta(t) r(t) x(t) y(t) z(t) t epsilon theta(t)
r(t) = sqrt((x(t))^2+(y(t))^2+(z(t))^2)
dtheta(t)=diff(theta(t),t)
alpha(t) = sqrt(( r+z(t))/(2*r))
beta(t) = (x(t)+ i*y(t))/sqrt(2*r*(r+z(t)))
diffeqn1 = epsilon*diff(x(t),t) == -y(t) - epsilon*dtheta(t)*z(t)
diffeqn2 = epsilon*diff(y(t),t) == x(t)
diffeqn3 = diff(z(t),t) == dtheta(t) * x(t)
diff(alpha(t),t)
But of course, I only get an expression involving the derivatives of x(t),y(t),z(t).
How can I make the program take diffeqn1 ,diffeqn2, diffeqn3 into consideration?
Any help would be massively appreciated.
1 Comment
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/572872-substituting-a-function-from-a-differential-equation#comment_955291
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/572872-substituting-a-function-from-a-differential-equation#comment_955291
Sign in to comment.