Gauss-Markov system from statistical steady-state
5 次查看(过去 30 天)
显示 更早的评论
I would like to write this code in a different way??. I have made some small changes but not sure what other modification could be made to get the same results.
%randn(%state’, 2920); n = 10; N = 100;
A = randn;
A = (0.99/max(abs(eig(A))))*A;
N = 100;
W = randn(10); W = W'*W; Whalf = sqrtm(W); Ex = dlyap(A, W);
subplot(211); cla reset; hold on; subplot(212); cla reset; hold on;
for j = 1:50
x_zero = zeros(n, N+1);
for i = 1:N
x_zero(:,i+1) = A*x_zero(:,i) + Whalf*randn(n,1);
end
x_ss = zeros(n, N); x_ss(:,1) = sqrtm(Ex)*randn(n,1);
for i = 1:N
x_ss(:,i+1) = A*x_ss(:,i) + Whalf*randn(n,1);
end
subplot(211); plot(0:N, x_zero(1,:)); subplot(212); plot(0:N, x_ss(1,:))
end
subplot(211); axis([0 N -50 50]); subplot(212); axis([0 N -50 50])
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!