-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdataAnalysis.m
More file actions
51 lines (34 loc) · 979 Bytes
/
dataAnalysis.m
File metadata and controls
51 lines (34 loc) · 979 Bytes
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
function dataAnalysis(filename)
obs = [68.5,81,64,43,53,41.5,47.5,52.5,57.5,62.5,97.5,103,96,82.5,97.5,87.5]';
calc = [73.97,83.86,67.02,42.48,52.92,40.28,47.97,52,58.04,62.8,95.95,206.91,95.95,82.03,100.34,86.06]';
data = importdata(filename)
format long;
[obs,idx] = sort(obs);
calc = calc(idx);
n = length(obs);
MSE = sum(sqrt(abs(calc-obs). ^2))/n
err = abs(calc-obs)./obs.*100;
b1 = obs\calc
linreg = b1*obs;
close all;
figure;
subplot 121;
h = stem(obs,calc,'filled','LineStyle','none', ...
'MarkerSize', 6,'MarkerFaceColor','b','LineWidth',2,'MarkerEdgeColor','k'); hold on;
plot(obs,linreg); hold off;
grid on;
title('Observing Error Over Varying Frequencies');
ylabel('Calculated RPM');
xlabel('Observed RPM');
ax = gca;
ax.TickDir = 'out';
ax.XLim = [0 250];
ax.YLim = [0 250];
subplot 122;
g = stem(obs,err);
ylabel('Error %');
xlabel('Observed RPM');
mstr = ['MSE:',num2str(MSE)];
str = {'Error is high','at higher RPMs.'};
text(65,60,str);
end