how to add white gaussian noise in controller design?

4 views (last 30 days)
hello,
i have a matlab script of LQG controller design and i want to add white gaussian noise in controller design how should i add it in script ?
in the following code there are two noise covariances, process and measured.
I want to add white Gaussian noise in the place of measured noise covariance
how should i do this ?
*******************************
clear all; clc; close all
load sec_sumsin_ABCDmatrix.mat % data As,Bs,Cs,Ds discrete measured data
syss=ss(As,Bs,Cs,Ds,0.001);
figure(1)
pzmap(syss)
syssc=d2c(syss,'tustin'); % convert from discrete to continuous
figure(4)
pzmap(syssc)
[Asc,Bsc,Csc,Dsc]=ssdata(syssc);
%%%%%define noise covariance and weighting matrices%%%%%%%%
nx=10; % states
ny=1; % output
nu=1; % input
M=diag([1.8108e0*ones(1,ny)]);
QX=Csc'*M*Csc;
f=zeros(nx,1);
g=zeros(1,nx);
QU=diag([3.9805e-8*ones(1,nu)]);
QXU=[QX f;g QU]; % design QXU weighting matrices
QW=1e-3*eye(nx); % process noise covariance
QV=1e-10*eye(ny); % measurement noise covariance
QWV=[QW f;g QV]; % design QWV weighting matrices
%%%%LQG Regulator%%%%%%
KlQG=lqg(syssc,QXU,QWV) % desing LQG regulator
%%%%%%%%%%%%%%%%%%%%%%%
[aa,bb,cc,dd]=ssdata(KlQG)
sysc=feedback(syssc,KlQG); % closed loop system
figure(2)
bode(syssc,'r')
hold on
bode(sysc,'b')
figure(3)
bode(KlQG,'g')
******************************
the representation of above code is like this, in the figure i have added white gaussian noise, instead of measurement noise .
and i want to write in the script for this .

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!