hai everyone , how do i write this sigmoid pid equation into matlab

 채택된 답변

Sam Chak
Sam Chak 2022년 5월 28일
편집: Sam Chak 2022년 5월 29일

1 개 추천

Hi Shah
I'm curious to to see how your designed Kp looks like. What is the pid equation?
Edit: Kp is a nonlinear proportional gain shaped by the sigmoid curve that is bounded by and .
% parameters
x = linspace(-6, 6, 1001);
Khigh = 5; % upper bound
Klow = 3; % lower bound
alpha = 1;
% construction of sigmoid
h = 1 + exp(-alpha*x);
g = Khigh - Klow;
f = g./h;
Kp = Klow + abs(f);
% plotting the nonlinear gain Kp
plot(x, Kp, 'linewidth', 1.5)
grid on
xlabel('error')
ylabel('Kp')

댓글 수: 5

Shaz Shah
Shaz Shah 2022년 5월 29일
hai sam chak
thank you for your response
PID equation is
Kpid(s) = Kp+Ki/s+Kds
after applied PID equation and sigmoid we will get base on equation on photo above but i just show for Kp only.
the parameter of K_low and K_high are lower and upper bounds of the coefficients, and e(t) is an error function
Thanks for the clarification. Then I think it should look like this, where x is the error signal measured somewhere. In this plot the error is defined through linspace.
x = linspace(-5, 5, 1001);
Khigh = 5;
Klow = 3;
alpha = 1;
h = 1 + exp(-alpha*x);
g = Khigh - Klow;
f = g./h;
Kp = Klow + abs(f);
plot(x, Kp)
Shaz Shah
Shaz Shah 2022년 5월 29일
편집: Shaz Shah 2022년 5월 29일
Thanks for your response
is it correct if i do the equation in direct straight line like this?
Kp = Klow - (abs(Khigh - Klow)/1 + exp(-alpha*x))
and can i know what is the problems in this error ?, i was stuck here
Error evaluating expression '1 e-5 ' for 'AbsTol' specified in the Configuration Parameters dialog for block diagram 'TRMS4SigmoidPID_simulink'.
Sam Chak
Sam Chak 2022년 5월 29일
편집: Sam Chak 2022년 5월 29일
You did not comment about the suggested sigmoid in my previous post (edited to add an image of the plot). Anyhow, using the same parameters,
x = linspace(-6, 6, 1001);
Khigh = 5; % upper bound
Klow = 3; % lower bound
alpha = 1;
I have fixed your code
Kp = Klow - (abs(Khigh - Klow)./(1 + exp(-alpha*x)));
and plotted it
plot(x, Kp, 'linewidth', 1.5)
grid on
xlabel('error')
ylabel('Kp')
but I don't see any straight line. Sigmoid should look like an 'S'-shaped curve. Furthermore, the upper and lower bounds are definitely incorrect. You are advised to sketch the 'S'-curve with the upper and lower bounds. Only then, I can give a proper advice on getting the desired Sigmoid curve.
Edit #1: I have made a minor modification. I think that your sigmoidal equation should look like this:
Kp = Khigh - (abs(Khigh - Klow)./(1 + exp(-alpha*x)));
Perhaps you mean this one:
Edit #2: I guess you want to enter the 'AbsTol' as
1e-5
without the space between '1' and 'e'.
Query:
Is there a reason for you to select the Logistic function as a sigmoid curve? Better performance?
By the way, technically, this should work already
Kp = Khigh - (Khigh - Klow)./(1 + exp(-alpha*x));
where abs(X) is unnecessary.
Shaz Shah
Shaz Shah 2022년 5월 31일
Thank you for your response ,
now i need to compare between Simoid PID (advance controller) and PID by get better performance for sigmoid PID. i was did for PID last week and now progress for Sigmoid PID. But have some error that i need to solve.

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

추가 답변 (1개)

Mohd Ashraf
Mohd Ashraf 2022년 11월 30일
편집: Mohd Ashraf 2022년 11월 30일

0 개 추천

Hi Shah,
You may refer to this link:
https://drive.google.com/uc?export=download&id=1Ut-zX3cTKn3r_kepRDe7_A5WPlsW3qjs
for the detail of the sigmoid PID code.

질문:

2022년 5월 26일

편집:

2022년 11월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by