forked from KyleZhang1118/Voice-Separation-and-Enhancement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoPlot.m
57 lines (56 loc) · 1.47 KB
/
autoPlot.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
function [] = autoPlot(S,method,fs,para)
% 'S':Len * Num, 'method' is the name of method,if the 2rd para is not char, then shift
sign_norm = 1;
if(~ischar(method))
if(~exist('fs','var'))
fs = method;
else
para = fs;
fs = method;
if(para==-1)
sign_norm = 0;
clear para;
end
end
clear method;
end
num = size(S,2);
po_x = size(S,1);
if(exist('fs','var'))
x = [1:size(S,1)]/fs;
po_x = max(x);
end
figure
for i = 1:num
eval(strcat('subplot(',num2str(num),'1',num2str(i),')'));
if(exist('x','var'))
plot(x,S(:,i))
else
plot(S(:,i))
end
if(sign_norm)
ylim([min(min(S)) max(max(S))])
end
xlabel('Time/s')
if(i==1 && exist('method','var'))
title(strrep(method,'_',' '))
end
if(exist('para','var'))
if(size(para,2)==3)
text(po_x,max(max(S))*0.9,num2str(para(i,1)))
text(po_x,max(max(S))*0.7,num2str(para(i,2)))
text(po_x,max(max(S))*0.5,num2str(para(i,3)))
continue;
end
if(size(para,2)>4 || size(para,2)==2)
text(po_x*0.9,max(max(S))*0.9,num2str(para(i,1)))
text(po_x*0.9,max(max(S))*0.7,num2str(para(i,2)))
end
if(size(para,2)>3)
text(po_x,max(max(S))*0.9,num2str(para(i,3)))
text(po_x,max(max(S))*0.7,num2str(para(i,4)))
text(po_x,max(max(S))*0.5,num2str(para(i,5)))
end
end
end
return