How can I use a closed loop for MPC for my use case?

조회 수: 1 (최근 30일)
Chandrakanth Pavanaskar
Chandrakanth Pavanaskar 2022년 9월 23일
댓글: Sam Chak 2022년 9월 24일
This is not the exact code but a reference code..
function x= mpc(y,..)
Ts=2e-6; %(Sampling time)
tend=0.02;
Nsim=tend/Ts;
y(1)=0.5;(this should be the value only for the first time when in the loop and the next values will be dependent on PWM signals)
x(1)=1;
for i=2:Nsim
x(2)=2*x(1)+5*y(1);
y(2)=y(1)*x(2);
x(2)=x(1);
y(2)=y(1);(This goes as input to other function model which calculates the value of y for next time step)
end
I want at each interval of 'i' the value of y to come out of the loop as for next time instant my value of y changes because the PWM signal of carrier defines the next value of y. Is there any way I can do this?
Any help would be very helpful..
  댓글 수: 5
Chandrakanth Pavanaskar
Chandrakanth Pavanaskar 2022년 9월 24일
Is it possible to call a matlab referred simulink function to call in other matlab referred simulink function?
Sam Chak
Sam Chak 2022년 9월 24일
I'm not sure if I understand what you meant. Perhaps you can try the sim() function. Check the details here:

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Plant Specification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by