-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_for_outputs_of_MC.m
59 lines (52 loc) · 1.24 KB
/
run_for_outputs_of_MC.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
bmain = [0.1084 0.5419 1.0837 1.0837 0.5419 0.1084]; %for case5
amain = [1 0.9853 0.9738 0.3864 0.1112 0.0113];
figure(1);
plot(1:maxit,meanfit,'r--','LineWidth',2)
ylim([-1 inf]);
% xlim([-1 inf]);
legend('MeanFitness')
xlabel('Iterations')
ylabel('Value')
title('Monte-Carlo');
grid on
figure(2);
plot(1:maxit,minfit,'b--','LineWidth',2);
axis([0 inf -.01 inf])
grid on
legend('MinFitness')
xlabel('Iterations')
ylabel('Value')
title('Monte-Carlo');
figure(3);
zplane(Z_f,P_f); %%% Displays the poles and zeros of discrete-time systems.
legend('Zero','Pole');
xlabel('Real Part');
ylabel('Imaginary Part');
title('Monte-Carlo: Pole-Zero Plot');
figure(4);
impz(bmain,amain);
hold on
impz(Bsoa,Asoa);
legend('Real Plant','Monte-Carlo');
xlabel('Time (sec)');
ylabel('Amplitude');
title('Impulse Response');
hold off
figure(5);
stepz(bmain,amain);
hold on
stepz(Bsoa,Asoa);
legend('Real Plant','Monte-Carlo');
xlabel('Time (sec)');
ylabel('Amplitude');
title('Step Response');
hold off
figure(6);
H = tf([bmain],[amain],1,'variable','z^-1');
% bode(H,{10^-4,10^1})
bode(H)
hold on
H = tf([Bsoa],[Asoa],1,'variable','z^-1');
bode(H)
legend('Real Plant','Monte-Carlo');
hold off