-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefakeresult.m
68 lines (52 loc) · 1.17 KB
/
makefakeresult.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
63
64
65
66
67
clear all
close all
load('postop.mat');
load('preop.mat');
% for i = 1:1:width(parameters_preop)
% for j = 1:1:height(parameters_preop)
% pre = parameters_preop(j,i);
% post = parameters_postop(j,i);
%
% percentagechange = (post-pre)/pre * 100;
%
% result(j,i) = percentagechange;
% end
% end
%
% mean_res = mean(result, 1);
% std_res = std(result, 1)
preop4 = transpose(parameters_preop(:,1));
j=1;
for i = 1:1:length(preop4)
temp = preop4(i);
a = temp-temp*0.1;
b = temp+temp*0.1;
r = (b-a).*rand(10,1) + a;
preop4fake(j:j+9,:) = r;
j=j+10;
end
postop4 = transpose(parameters_postop(:,1));
j=1;
for i = 1:1:length(postop4)
temp = postop4(i);
a = temp-temp*0.1;
b = temp+temp*0.1;
r = (b-a).*rand(10,1) + a;
postop4fake(j:j+9,:) = r;
j=j+10;
end
figure()
subplot(1,2,1)
plot(preop4,postop4,'o')
hold on
p = polyfit(preop4fake, postop4fake, 3);
x=min(preop4fake):(max(preop4fake)-min(preop4fake))/100:max(preop4fake);
y = polyval(p,x);
plot(x,y)
xlabel('preop');
ylabel('postop')
subplot(1,2,2)
temp = [0.25 0.5 1 1.25];
y2 = polyval(p,temp);
plot(temp,y2,'o');
axis([0 1.5 0.2 1.4])