help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generate venn diagram from data


From: fna1
Subject: Generate venn diagram from data
Date: Sat, 29 Apr 2017 09:57:32 -0700 (PDT)

Hi everyone, I am really new with MATLAB/Octave ,
So , I would like to do some coding to generate venn diagram from data via
Matlab.
however, after a few attempts, it's still failed and have a lot of error .
p/s i did load pkg image and found strel error

So here are my coding ,
pHiv = input ("Enter the prior probability of having HIV :");
pSr = input ("Enter the sensitivity rates (eg : 95%) :");
%Enter the sensitivity rates (eg : 95%) :85
pFr = input ("Enter the false alarm rates (eg: 7.8%) :");
%Enter the false alarm rates (eg: 7.8%) :7.5
pS = pSr / 100;
pF = pFr / 100;
pxHiv = 1 - pHiv ;
pxS = 1 - pS;
pxF = 1 - pF;
pP = (pHiv * pS ) + (pxHiv * pF);
pN = (pHiv * pxS) + (pxHiv * pxF);
pHivGp = (pHiv * pS) / pP;
pHivGn = (pHiv * pxS) / pN;
pxHivGn = (pxHiv * pxF) / pN;
pxHivGp =(pxHiv * pF ) / pP;
disp ( "The value of posterior probability of HIV positive:"), disp(pHivGp);
%The value of posterior probability of HIV positive:
 %0.18785
disp ( "The value of posterior probability of HIV negative:"), disp(pHivGn);
%The value of posterior probability of HIV negative:
 %0.0032985
disp ( "The value of posterior probability of no HIV psoitive:"),
disp(pxHivGp);
%The value of posterior probability of no HIV psoitive:
 %0.81215
disp ( "The value of posterior probability of no HIV negative:"),
disp(pxHivGn);
%The value of posterior probability of no HIV negative:
 %0.99670









xp = linspace(-1,1,256);
x = ones(size(xp))'*xp;
y = xp'*ones(size(xp));
pHiv = sqrt((x+0.3).^2+y.^2)<0.6;
pxHiv = sqrt((x-0.3).^2+y.^2)<0.6;
r1= max(find(xp<-0.7));
r2 = min(find(xp>0.7));
pHiv = pHiv(r1:r2,:);
pxHiv= pxHiv(r1:r2,:);

% generate outlined box
sz = size(pHiv);
u = ones(sz);
u(1:2,:)=0;
u(:,1:2)=0;
u(sz(1)-(0:1),:)=0;
u(:,sz(2)-(0:1))=0;

%generating edge image.
se = strel('disk',2);
ae = pHiv - imerode(pHiv,se);
be = pxHiv - imerode(pHiv,se);

ue = double(and(u,~(ae|be)));

% generate example venn diagram
z = xor(pHiv,pxHiv);
rgb = cat(3,ue,ue,and(ue,~z));
imshow(rgb);


Thank you for helping me out.




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Generate-venn-diagram-from-data-tp4683112.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]