how can i imploy pid on a mass spring damper showing a car model in m file using oe45
Ältere Kommentare anzeigen
mean when i make an equation i.e. m*v(dot)+bv=u and solve it using ode45 in m file how can i employ PID there for a cruise contol. I can find the same solution on net in crise control tutorials but they use either transfer function or state space, but i dnt find the same solution using ode45. can any body suggest how to use PID with ode45.two m files are listed below. please any body can suggest how to controll the out put using a PID controller for a cruise control
first m file
function ydot=cruise(t,y)
m_CoG=1000;
u=500;
b=50;
f1=-(b/m_CoG)*y(1)+(1/m_CoG)*u;
ydot=f1;
2nd m file to run the above one is as:
clc;
clear all;
close all;
tspan=[0 20];
y0=0;
[t,y]=ode45(@cruise,tspan,y0);
figure(1)
plot(t,y(:,1),'-r')
xlabel('time');
ylabel('velocity')
grid on
Antworten (1)
Arkadiy Turevskiy
am 18 Mär. 2013
0 Stimmen
It would be easier to do with state space or a transfer function, like you saw in the tutorials. If you want to use ode45, you will have to formulate the differential equations for the system with PID included.
1 Kommentar
Rizwan Latif
am 25 Mär. 2013
Kategorien
Mehr zu PID Controller Tuning finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!