I want to differentiate these equation with matlab.I use input v1 as constant 1 and for input v2 use signal builder for ( time 1 to 4 input 0;time 4 to 6 input 1,time 6 to 10 input 0).please help me.
x1dot=v1*sin(x3);
x2dot=v1*cos(x3);
x3dot=v2;

 Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 18 Okt. 2020

0 Stimmen

This is a system of ODE. You can use ode45() to find a solution
tspan = [0 10];
IC = [0; 0; 0]; % initial condition
[t, X] = ode45(@odeFun, tspan, IC);
plot(t, X);
legend({'x1', 'x2', 'x3'}, 'FontSize', 16);
function xdot = odeFun(t, x)
v1 = 1;
if t < 4
v2 = 0;
elseif t < 6
v2 = 1;
else
v2 = 0;
end
x3 = x(3);
x1dot=v1*sin(x3);
x2dot=v1*cos(x3);
x3dot=v2;
xdot = [x1dot; x2dot; x3dot];
end

1 Kommentar

htethtetoo santhu
htethtetoo santhu am 18 Okt. 2020
Bearbeitet: htethtetoo santhu am 18 Okt. 2020
@Ammer Hamza,thank you for your help.Can i solve these equation with dsolve() function and how can I calculate the value of x1dot,x2dot,x3dot solution.If I can,how can I do?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by