I want to plot (x vs t ) of a differential equation containing signum function.please help ASAP
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
RAJAT
el 30 de Sept. de 2023
Respondida: Sam Chak
el 30 de Sept. de 2023
X" + x + signum(x') =0
0 comentarios
Respuesta aceptada
Sam Chak
el 30 de Sept. de 2023
Hi @RAJAT
You can find examples of solving ordinary differential equations in this link:
F = ode; % ODE object
F.InitialValue = [2; 0]; % initial values
F.ODEFcn = @(t, x) [x(2); % x1'
- sign(x(2)) - x(1)]; % x2'
F.SelectedSolver
S = solve(F, 0, 10); % Solve the ODE from 0 to 10 sec
% plot(S.Time, S.Solution(1,:), "-o"), grid on % plot x1 vs t only
plot(S.Time, S.Solution, "-o"), grid on % plot x1 and x2
xlabel('t'), ylabel('\bf{x}(t)')
legend("x_1", "x_2", Location="northeast")
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!