how to write PID function in .m file

i need a pid function in my m file. could anyone please write the function.

2 件のコメント

Hero
Hero 2016 年 3 月 18 日
I do have same question
PUJARI MURAGA
PUJARI MURAGA 2016 年 12 月 1 日
You are having state space model. Suppose I have differential equations then is it possible to do without converting them in state space/laplace ?

サインインしてコメントする。

 採用された回答

Arkadiy Turevskiy
Arkadiy Turevskiy 2012 年 5 月 14 日
編集済み: Arkadiy Turevskiy 2014 年 10 月 27 日

0 投票

This demo might help.
Arkadiy

2 件のコメント

sujan
sujan 2012 年 5 月 17 日
thank you,
but my model is a space state model, and it has many tf. and i dont know how to connect space state form and PID controller. so could you please tell me how to use PID in m file which is not in tranfer function. thank you Arkadiy
Arkadiy Turevskiy
Arkadiy Turevskiy 2012 年 5 月 17 日
well, how many inputs and outputs does you system have? If is a single-input-single output system, then everything shown in the demo is still applicable.If you more comfortable dealing with transfer functions, convert your state space system to a transfer function using tf:
ss_sys=ss(a,b,c,d);
tf_sys=tf(ss_sys);

サインインしてコメントする。

その他の回答 (2 件)

Krishnendu Mukherjee
Krishnendu Mukherjee 2012 年 5 月 14 日

0 投票

a way is there : suppose ur tf is (1/a+s) which is to be fed to a pid controler. then the overall tf will be: (Kp+Ki/S+Kd.S).(i/S+a)/(1+(Kp+Ki/S+Kd.S).(i/S+a)). now if you want to give step input then : num=[............] den=[............] tf=num/den ster(tf) so you have to transfer the PID and the tf to a overall transfer function.

1 件のコメント

sujan
sujan 2012 年 5 月 17 日
thank you,
but my model is a space state model and its has 9 state parameters. and i dont know how to use PID in my system. and it is a MIMO system. 4 inputs and 9 outputs. so could you please help me to write a PID function for space state form not in tf. thank you

サインインしてコメントする。

Daniel
Daniel 2014 年 10 月 24 日

0 投票

Please where's the demo? I'm also trying to write a matlab function for pid using the user-defined function block

3 件のコメント

Arkadiy Turevskiy
Arkadiy Turevskiy 2014 年 10 月 27 日
html link added back
Suyog
Suyog 2023 年 5 月 11 日
How to write pid function in m file
Sam Chak
Sam Chak 2023 年 5 月 11 日
  1. You can use the pid() function directly.
  2. You can describe that in transfer function.
  3. You can model it using the descriptor state-space.
  4. Finally, you can put the pid equation in the way that is similar to the ordinary differential equation (ODE).

サインインしてコメントする。

カテゴリ

タグ

質問済み:

2012 年 5 月 14 日

コメント済み:

2023 年 5 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by