-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdatePlot.m
62 lines (57 loc) · 1.5 KB
/
updatePlot.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
60
61
62
function updatePlot(fig)
%% updatePlot update function plots
% This function updates the axes containg curves of refernce function and
% VF function.
%
% INPUTS
% fig: GUI figure, figure [1 x 1]
%
% SYNTAX
% updatePlot(fig)
%
% © 2019, Petr Kadlec, BUT, [email protected]
h = getappdata(fig, 'handles');
data = getappdata(fig, 'values');
switch h.bgPlotSpec.SelectedObject.String
case 'Abs'
hFun = @(x) abs(x);
case 'Real'
hFun = @(x) real(x);
case 'Imag'
hFun = @(x) imag(x);
end
if isfield(data, 'funRef')
plot(h.axes, data.frequency, hFun(data.funRef), 'b-', ...
'LineWidth', 2);
h.legend = legend('ref fun');
h.axes.NextPlot = 'add';
end
if isfield(data, 'funVF')
plot(h.axes, data.frequency, hFun(data.funVF), 'r--o', ...
'LineWidth', 2);
h.legend = legend('ref fun', 'VF fun');
h.textResNPoles.String = ...
['# poles N = ', sprintf('%d', size(data.model.poles, 1))];
end
if h.buttLogX.Value
h.axes.XScale = 'log';
else
h.axes.XScale = 'linear';
end
if h.buttLogY.Value
h.axes.YScale = 'log';
else
h.axes.YScale = 'linear';
end
h.axes.NextPlot = 'replacechildren';
if isfield(data, 'rmse')
h.textResRmse.String = ['rmse = ', sprintf('%1.3e', data.rmse)];
if data.rmse <= str2num(h.autoEditRmse.String) %#ok<*ST2NM>
% OK
h.textResRmse.BackgroundColor = [0.57, 1, 0.6];
else
% not OK
h.textResRmse.BackgroundColor = [1, 0.75, 0.7];
end
end
end