How to use syms in multiple variable?

2 visualizaciones (últimos 30 días)
Yokuna
Yokuna el 7 de Abr. de 2022
Comentada: John D'Errico el 27 de Feb. de 2023
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 comentarios
Walter Roberson
Walter Roberson el 7 de Abr. de 2022
mu and k variables are not defined
John D'Errico
John D'Errico el 27 de Feb. de 2023
Please don't use a flag to say your own question is not clear. If it is not clear, then make it clear.

Iniciar sesión para comentar.

Respuestas (1)

Torsten
Torsten el 7 de Abr. de 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);

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by