how to do vector symbolic differentiation
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
could I get help in writing vector symbolic differentiation
I wanna declare LA , Th2_2 ,ThA_2 as vectors where their values are seted in vector (1,11) for differtent time . note that each value of LA, Th2_2 and ThA_2 correspond to each other for the same time. so they must be used in the equation based on that.
how can I edit the code to get the solutions for Om2 and OmA as vectors as well
Thanks in advance for any help..
%Parameters
syms L1_2 L2_2 Th1 Th1_2 integer
% variables and their derivatives
syms LA Th2_2 Om2 ThA_2 OmA integer
%loop eqn.
L_eqn1 = L2_2*exp(1i*Th2_2)+LA.*exp(1i*ThA_2) -L1_2*exp(1i*Th1_2)==0;
%velocity eqn for Om2 and OmA.
dL_eqn1 = diff(L_eqn1,Th2_2)*Om2 +diff(L_eqn1,ThA_2)*OmA- v*exp(1i*ThA_2);
real_vel_eqn1 = real(dL_eqn1);
imag_vel_eqn1 = imag(dL_eqn1);
[Om2, OmA]=solve (real_vel_eqn1, imag_vel_eqn1);
6 Kommentare
Walter Roberson
am 3 Nov. 2019
diff(L_eqn1,Th2_2)
You are asking to differentiate the vector L_eqn1 at the vector of variables Th2_2 . With the vectors being the same length, perhaps you are wanting to differentiate with corresponding variables. A single diff() call will not do that, but you can
arrayfun(@diff, L_eqn1, Th2_2)
Keep in mind, though, that you are differentiating an equation, which is going to have the effect of differentiating both sides of the equation. It is legal to then multiply by a constant, which has the effect of multiplying both sides by a constant, and it is legal to add equations... but when you find yourself multiplying or adding equations, you should stop to ask yourself whether that is really what you want to do, or if instead you should be working with just the expressions rather than the equations.
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!