0
\$\begingroup\$

I am trying to use MATLAB to calculate a steady-state error. I have found a weblink that gives code for finding the steady-state error, but when I use that code I get a value of the steady-error greater than 1. In my understanding, a steady-state error should be less than 1, because formula of steady-state error in case of step input = 1/(1+k)

The code:

sserror=abs(SP-y(end))

When I try to incorporate the above code into my code to get the steady-state error:

clc;clear all;close all
%defining parameters values
Ra=1
Kt=10
Kb=0.1
j=2
b=0.5
%defining numerator & denominator of system1 (1/js+b)
num=[1]
den=[j b]
% creating transfer function for system 1
sys1=tf(num,den)
%Applying block diagram reduction and simplification techniques
sys2=(-Kb)*Kt/Ra
%Creating a positive feedback system from above two systems sys1 and sys2
a=feedback(sys1,sys2,1)
%Introducing the effect of disturbance input 
OL=-1*a
%Calculating step response & extracting amplitude & time matrices
[y,t]=step(OL)
%Plotting  values of amplitude matrix extracted from  step resposne
plot(y)
%Calculating length(total number of elements) for timing matrix 
z=length(t)
%Finding value of last element of amplitude matrix
%That is also value of steady state speed
open_loop_steady_state_speed=y(z)
SP=1 % set point incase of step input
sserror=abs(SP-y(end))

I am trying to simulate a block diagram from a book, Modern Control Systems. I am also attaching a snapshot of that block diagram.

There are two block diagrams in the snapshot, one is for an open-loop control system and the other is for a closed-loop control system.

I am considering and trying to write code for an open-loop system.

Update: Note: Plot has been added in response to comment

enter image description here

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ Can you post a time versus value plot of the signal? \$\endgroup\$
    – AJN
    Commented Sep 30, 2021 at 15:45
  • \$\begingroup\$ If the set point is positive, then clearly the steady state error is more than one since the response is negative value. \$\endgroup\$
    – AJN
    Commented Oct 1, 2021 at 8:30
  • \$\begingroup\$ Good day. I don't have an answer to the question but wanted to ask the name/title of the book where are figures 4.7 and 4.9 from. Could you say, please? \$\endgroup\$
    – Agasha
    Commented Nov 21, 2021 at 10:17
  • \$\begingroup\$ @Agasha - Hi, I didn't write the question, but I believe I recognise the figures as being from the book "Modern Control Systems" by Richard C. Dorf and Robert H. Bishop. Hopefully LECS can confirm that. \$\endgroup\$
    – SamGibson
    Commented Nov 21, 2021 at 15:47

2 Answers 2

1
\$\begingroup\$
a=feedback(sys1,sys2,1)

OL=-1*a

[y,t]=step(OL)

The output of the closed loop system is negated before it is supplied to the step function.

So even though the output of the original system a is going to 0.66 (steady state error 0.33), due to the negation of the output in OL, the calculation returns 1.66 > 1.

What is the reason / logic for doing OL = -1 * a ?

Note

There is one logical error also.

[y,t]=step(OL)         % SP is NOT the input given here!
SP=1                   % the set point has NO effect on y !
sserror=abs(SP-y(end)) % this calculation is hence invalid

Since the step function is called before setting the setpoint SP, the calculation SP - y(end) is invalid since SP was not the input actually supplied to the system.

The code in the link you provided in the question has the correct order of operations.

SP=5; %input value, if you put 1 then is the same as step(sys)
[y,t]=step(SP*sys); %get the response of the system to a step with amplitude SP
sserror=abs(SP-y(end)) %get the steady state error
\$\endgroup\$
0
\$\begingroup\$

enter image description here

I think you should be treating at the system like this, and analyze the system this way, taking \$T_d(s)\$ as your main input. With such a diagram, the definition for sys2 and sys1 changes, as you might notice. It becomes the formula below.

$$sys2=\frac{K_m(K_tK_b+K_a)}{R_a}$$ $$sys1=\frac{-1}{Js+b}$$

Rewriting the code according to this might yield a correct result.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.