# Generate venn diagram from data

 Classic List Threaded
3 messages
Reply | Threaded
Open this post in threaded view
|

## Generate venn diagram from data

 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.
Reply | Threaded
Open this post in threaded view
|

## Re: Generate venn diagram from data

 Currently the image package only supports strel objects of disk type with no sub-components. So you need to change your code line with the strel command to the following line: se = strel('disk',2,0); With this little change, your script runs fine for me. Have fun with Octave and the image package    Hartmut
Reply | Threaded
Open this post in threaded view
|

## Re: Generate venn diagram from data

 Thank you so much!! , it is working fine!