Borrar filtros
Borrar filtros

Adding noise to a PID signal

42 visualizaciones (últimos 30 días)
Nathan Ross
Nathan Ross el 18 de Mzo. de 2022
Comentada: Sam Chak el 31 de Mzo. de 2022
Hi everyone, As the title says I have created a PID system, and am attempting to add random noise over the created signal, but am unsure how to create the noise in this instance as it is not a normal function. Any advice or tips on how do add noise in this domain is greatly appreiated. Code is shown below
clear % housekeeping
clc % housekeeping
num= [1] % num of transfer function
denom= [1 3 1] % denom of transfer function
gp= tf(num, denom) % transfer function
h= [1] ; % feedback
m_nocontroller=feedback(gp, h)
hold on
gc=pid(kp, ki, kd)
mc=feedback(gc*gp, h)
grid on

Respuestas (1)

Pat Gipper
Pat Gipper el 31 de Mzo. de 2022
Hi Nathan,
You can use the lsim command to get a general response of your controller. I think you want to see the response when there is noise added to the input command. The code snippet below will do this for you.
t=(0:.001:7)';% time vector
u=ones(size(t));% input vector
n=randn(size(t));% Normal distributed samples
y=lsim(mc,u+n,t);% System response to step + random noise
% Plot PID response to unit step with added noise
Sometimes the noise is added in at a separate point in the system as a disturbance. For example, it might be a disturbance that is added after the PID controller. But you would need to re-create your system object with the second input to do this.
  1 comentario
Sam Chak
Sam Chak el 31 de Mzo. de 2022
Thank you for the suggested solution to plot the noise-contaminated system output.
Since the output measurement is contaminated by noise, it will affect the PID controller output signal as well. Would you advise @Nathan Ross on how to plot the noise-contaminated PID control signal for a linear system as well?

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by