(Simulink/MPC) Unable to linearize with an if...else loop

조회 수: 2 (최근 30일)
Tan Edwin
Tan Edwin 2011년 5월 27일
I am trying to design an MPC Control for my project but it seems that the Simulink cannot linearize my model accurately due to the presence of an embe dded-MATLAB function block containing an if...else loop.
My model looks like this: (dunno how to upload photos. sry)
Embedded MATLAB -> Plant Model -> MPC--
^ |
|______________________________________|
And th function in the embedded MATLAB is
function EmbeddedMATLAB=Output(t,u)
% t = time and u= output from MPC Controller
if t<3
Output=100;
else Output =u;
end
After designing the MPC Controller, the linearized result for the MPC Controller was 0. So how shlould i go about doing it?

답변 (1개)

Erman Korkut
Erman Korkut 2011년 5월 31일
Hi Tan,
The Embedded MATLAB function blocks are linearized using numerical perturbation by default. Your code seems to indicate that if you linearize your model at a time smaller than 3, the embedded matlab block's output is not a function of input u; instead it is fixed and thus its derivate is zero, thus linearizing to zero.
If you would like to specify a custom linearization for your Embedded MATLAB function block, you can right-click on it and select Linear Analysis->Specify Linearization. Then you can specify the linearization of this block.
Thanks, Erman

카테고리

Help CenterFile Exchange에서 Refinement에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by