Mischa Megens / Mbed 2 deprecated dacadctodiskshort

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers overview.cpp Source File

overview.cpp

00001 % matlab code to plot results (multiple files):
00002 
00003 fs={'OUT.TXT'
00004     'OUTPSU.TXT'
00005     'OUTUSBtiedgnd.TXT'
00006     'OUTPSUtiedgnd.TXT'
00007     'OUTUSBlongwait.TXT'
00008     'OUTPSUlongwait.TXT'
00009     'OUTUSBtiedgndlongwait.TXT'
00010     'OUTPSUtiedgndlongwait.TXT'};
00011 clear d
00012 for i=1:numel(fs),
00013   fh=fopen(fs{i},'r');
00014   d(:,:,i)=fix(fread(fh,[100,1024],'uint16')/16);
00015   fclose(fh);
00016 end
00017 
00018 %all the measurements as dots:
00019 figure
00020 m=0:1023;
00021 m=repmat(m*4,[size(d,1),1,size(d,3)]);
00022 c='rgbmrgbm';
00023 for i=5:8,
00024   plot(m(:,:,i),d(:,:,i),[c(i) '.']); hold on
00025 end
00026 axis tight
00027 
00028 %statistics:
00029 d=reshape(d,100*1024,8);
00030 m=reshape(m,100*1024,8);
00031 m=m+median(d(:)-m(:));
00032 top=(d>4096-6 & m<4096-100);
00033 bottom=(d<6 & m>100);
00034 above=(d>m+100 & d<=4096-6);
00035 below=(d<m-100 & d>=6);
00036 bar(0:7,[sum(bottom); sum(below); sum(above); sum(top)]','stacked')
00037 
00038 figure
00039 plot(m,d,'k.'); hold on
00040 plot(m(top),d(top),'r.'); hold on
00041 plot(m(above),d(above),'y.'); hold on
00042 plot(m(below),d(below),'c.'); hold on
00043 plot(m(bottom),d(bottom),'b.'); hold on
00044 axis tight