assessment of the control loop performance using the Integral of the absolute error (IAE) performance index

7 visualizaciones (últimos 30 días)
I am not getting anything related to P_Measure.IAE = trapz(t, abs(e));
I used the code below:
clear all;
close all;
%% define num and den of tf
%Gp defining
num=[0.8];
den=[10 1];
Gp=tf(num,den,'IODelay',9)
%Gc defining
kc=(0.5*10)/(0.8*9);
Ti=10;
Gc=kc+tf([kc],[Ti]);
%defining Gd
Gd=tf([-4],[1 15], 'IODelay',9)
% close loop transfer function
%change in set point
GCL1=Gc*Gp/(1+Gc*Gp)
GCL1= minreal(GCL1)
%disturbnance
GCL2=Gd/(1+Gc*Gp)
GCL2= minreal(GCL2)
% Simulate closed loop tranfer function
T_Final = 100;
[y1, t1] = step(Gp, T_Final)
[y2,t2]=step(GCL1,T_Final)
[y3,t3]=step(GCL2,T_Final)
[y4,t4]=step(Gd,T_Final)
plot(t2,y2,'k','linewidth',2)
hold on
plot(t3,y3,'y','linewidth',2)
hold on
plot(t1,y1,'m','linewidth',2)
hold on
plot(t4,y4,'c','linewidth',2)
hold off
legend('Setpoint changes','Disturbance changes', 'Gp', 'Gd')
ylabel('output')
xlabel('time(min)')
%
G = 1 / (1 + Gc * Gp);
T_Final=100;
function [P_Measure] = Performance(G, T_Final);
[e, t] = step(G, T_Final);
P_Measure.IAE = trapz(t, abs(e));
end

Respuestas (1)

Akanksha
Akanksha el 28 de Abr. de 2025
The issue is caused due to usage of P_Measure.IAE = trapz(t, abs(e)); inside a function, but did not define the error signal e ie e = setpoint - output correctly for your closed-loop setpoint change.
Also, in R2018b, you cannot define a function at the end of a script (unless you use a separate function file or a live script).
This could easily be resolved. Please go through the code below that will help you to get the required output.
% Control Loop Performance Assessment using IAE
clear all;
close all;
clc
%% 1. Define Process (Gp) and Controller (Gc)
num = [0.8];
den = [10 1];
Gp = tf(num, den, 'IODelay', 9);
kc = (0.5 * 10) / (0.8 * 9);
Ti = 10;
Gc = kc + tf([kc], [Ti]);
%% 2. Closed-Loop Transfer Function for Setpoint Change
GCL = feedback(Gc * Gp, 1); % Unity feedback
%% 3. Simulate Step Response (Setpoint Change)
T_Final = 100;
[y, t] = step(GCL, T_Final); % y is the output, t is the time vector
%% 4. Calculate Error Signal (e = r - y)
r = ones(size(t)); % Unit step setpoint
e = r - y; % Error at each time point
%% 5. Calculate IAE (Integral of Absolute Error)
IAE = trapz(t, abs(e));
%% 6. Display and Plot Results
disp(['Integral of Absolute Error (IAE): ', num2str(IAE)]);
figure;
plot(t, y, 'b', 'LineWidth', 2); hold on;
plot(t, r, 'r--', 'LineWidth', 1.5);
plot(t, e, 'k:', 'LineWidth', 1.5);
legend('Output y(t)', 'Setpoint r(t)', 'Error e(t)');
xlabel('Time (min)');
ylabel('Value');
title(['Closed-loop Response and Error, IAE = ', num2str(IAE)]);
grid on;
I have attached the screenshots of the solution I got, whilst running the above code in R2018b MATLAB.
Also, for futher references on you can type "doc <keyword you need help with>" to open the documentation for the MATLAB R2018b release as shown below.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by