필터 지우기
필터 지우기

matlab question response question

조회 수: 2 (최근 30일)
johnaly7
johnaly7 2014년 3월 13일
편집: johnaly7 2014년 7월 21일
I have a control system with a PID controller, and im trying to simulate a system response, i need to plot the values first in a graph and then add the transfer function?
this is what i have found and im doing:
dt = 0.1; t = 0:dt:50; u = zeros(1,numel(t)); u(t<=20) = 45; u(t> 20 & t<=40) = -45; u(t> 40) = 0;
obviously with the lsim command
Is there a better way ?
Thanks in advance

채택된 답변

Mischa Kim
Mischa Kim 2014년 3월 14일
편집: Mischa Kim 2014년 3월 14일
John, you just need to build the signal (no need for plotting), e.g.,
dt = 0.1; % adjust as necessary
t = 0:dt:50;
u = zeros(1,numel(t));
u(t<=20) = 45; % you probably want to use rad instead of deg
u(t> 20 & t<=40) = -45;
u(t> 40) = 0;
and feed it as an input to the system.
  댓글 수: 1
Mischa Kim
Mischa Kim 2014년 3월 14일
편집: Mischa Kim 2014년 3월 14일
Correct,
lsim(sys,u,t)
or similar. You might have/want to specify initial conditions x0 for the system, in which case you'll have an additional parameter.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 PID Controller Tuning에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by