how can i imploy pid on a mass spring damper showing a car model in m file using oe45
조회 수: 2 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
Arkadiy Turevskiy
2013년 3월 18일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 PID Controller Tuning에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!