How to use syms in multiple variable?
3 views (last 30 days)
Show older comments
I wrote a code to integrate a function with respect to time, but it gives an error message. I am not able to identify the mistake in writing the code. Please help.
syms x1 x2 x3 t
c1(x1,t)=5*x1^2*t+5*x1+5;
c2(x2,t)=6*x2^2*t+6*x2+6;
c3(x3,t)=7*x3^2*t+7*x3+7;
chi1=diff(c1,x1);
chi2=diff(c2,x2);
chi3=diff(c3,x3);
y1_dot=(-k1*sign(+1*(chi2-chi1))*abs(+1*(chi2-chi1))^mu-k2*sign(+1*(chi2-chi1))*abs(+1*(chi2-chi1))^nu);
y2_dot=(-k1*sign(+1*(chi1-chi2)+1*(chi3-chi2))*abs(+1*(chi1-chi2)+1*(chi3-chi2))^mu-k2*sign(+1*(chi1-chi2)+1*(chi3-chi2))*abs(+1*(chi1-chi2)+1*(chi3-chi2))^nu);
y3_dot=(-k1*sign(+1*(chi2-chi3))*abs(+1*(chi2-chi3))^mu-k2*sign(+1*(chi2-chi3))*abs(+1*(chi2-chi3))^nu);
y1=int(y1_dot,t);
y2=int(y2_dot,t);
y3=int(y3_dot,t);
3 Comments
John D'Errico
on 27 Feb 2023
Please don't use a flag to say your own question is not clear. If it is not clear, then make it clear.
Answers (1)
Torsten
on 7 Apr 2022
This code does not throw an error, but I don't know whether it will succeed to find an antiderivative for your expressions.
syms x1 x2 x3 t k1 k2 mu nu
c1=5*x1^2*t+5*x1+5;
c2=6*x2^2*t+6*x2+6;
c3=7*x3^2*t+7*x3+7;
chi1=diff(c1,x1);
chi2=diff(c2,x2);
chi3=diff(c3,x3);
y1_dot=(-k1*sign(+1*(chi2-chi1))*abs(+1*(chi2-chi1))^mu-k2*sign(+1*(chi2-chi1))*abs(+1*(chi2-chi1))^nu);
y2_dot=(-k1*sign(+1*(chi1-chi2)+1*(chi3-chi2))*abs(+1*(chi1-chi2)+1*(chi3-chi2))^mu-k2*sign(+1*(chi1-chi2)+1*(chi3-chi2))*abs(+1*(chi1-chi2)+1*(chi3-chi2))^nu);
y3_dot=(-k1*sign(+1*(chi2-chi3))*abs(+1*(chi2-chi3))^mu-k2*sign(+1*(chi2-chi3))*abs(+1*(chi2-chi3))^nu);
y1=int(y1_dot,t);
y2=int(y2_dot,t);
y3=int(y3_dot,t);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!