Home > matlab > misc > sopt_mltb_modifypdf.m

sopt_mltb_modifypdf

PURPOSE ^

sopt_mltb_modifypdf - Modify PDF of sampling profile

SYNOPSIS ^

function [new_pdf, alpha] = sopt_mltb_modifypdf(pdf, nb_meas)

DESCRIPTION ^

 sopt_mltb_modifypdf - Modify PDF of sampling profile
 
 Checks PDF of the sampling profile and normalizes it. It is used
 in sopt_mltb_vdsmask in the generation of variable density sampling
 profiles.

 Inputs:

   - pdf: Sampling profile function.

   - nb_meas: Number of measurements.

 Outputs:

   - new_pdf: New sampling profile function.

   - alpha: DC level for the required number of samples.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [new_pdf, alpha] = sopt_mltb_modifypdf(pdf, nb_meas)
0002 % sopt_mltb_modifypdf - Modify PDF of sampling profile
0003 %
0004 % Checks PDF of the sampling profile and normalizes it. It is used
0005 % in sopt_mltb_vdsmask in the generation of variable density sampling
0006 % profiles.
0007 %
0008 % Inputs:
0009 %
0010 %   - pdf: Sampling profile function.
0011 %
0012 %   - nb_meas: Number of measurements.
0013 %
0014 % Outputs:
0015 %
0016 %   - new_pdf: New sampling profile function.
0017 %
0018 %   - alpha: DC level for the required number of samples.
0019 
0020 if sum(pdf(:)<0)>0
0021     error('PDF contains negative values');
0022 end
0023 pdf = pdf/max(pdf(:));
0024 
0025 % Find alpha
0026 alpha_min = -1; alpha_max = 1;
0027 while 1
0028     alpha = (alpha_min + alpha_max)/2;
0029     new_pdf = pdf + alpha;
0030     new_pdf(new_pdf>1) = 1; new_pdf(new_pdf<0) = 0;
0031     M = round(sum(new_pdf(:)));
0032     if M > nb_meas
0033         alpha_max = alpha;
0034     elseif M < nb_meas
0035         alpha_min = alpha;
0036     else
0037         break;
0038     end
0039 end
0040

Generated on Fri 22-Feb-2013 15:54:47 by m2html © 2005