How to use syms in multiple variable?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
John D'Errico
2023년 2월 27일
Please don't use a flag to say your own question is not clear. If it is not clear, then make it clear.
답변 (1개)
Torsten
2022년 4월 7일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!