Home > database >  Matlab for help
Matlab for help

Time:09-17

1. The function varargout=unwrap_ one_ d (w_ ph, s _ph, th)
2. % row (or column) of the completion of this function package solution of phase operators
3. % format un_ ph=unwrap _one_ d (w_ ph, s_ ph, th);
4. The three variables: % input w_ ph for the wrapped phase, s_ ph is starting phase value, and th is domain values
5. % if phase values wrapped in (- PI, PI], domain value th PI; If the phase values wrapped in (PI/2, PI/2], th take PI/2
6. % output variable un_ph wrapped phase values for solution
7. Numb=length (w_ ph); % to calculate the size of the wrapped phase (element)
8. Un_ ph=w_ ph; % will be wrapped phase values assigned to un_ ph - the default solution package phase
9. Un_ ph (1)=s_ ph; % will be starting phase assigned to un_ ph of the first element (no longer attend the solution package)
10. The for n=2: numb % from the second element solution package operation
11. The delta ph (n) - w_ ph=w_ (n - 1); % of adjacent two wrapped phase comparison (subtraction)
12. The if (abs (delta) & lt;=th) % difference is not greater than domain values
13. Un_ ph (n)=un_ ph (n - 1) + delta; Package % solution phase is equal to the previous solution package phase value difference
14. Elseif (delta<0) % difference is greater than the threshold, and the difference between negative
Un_ ph (n)=15 un_ ph (n - 1) + delta + 2 * th; Before the % a package solution phase value with difference 2 times more domain
16. The else % difference is greater than the threshold, and the difference is
17. Un_ ph (n)=un_ ph (n - 1) + delta - 2 * th; % before a solution package phase value plus the difference will be a reduction of 2 times domain
18. End
19. The end
20. Varargout {1}=un_ph; % wrap solution phase values assigned to the output variable
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- are all functions above, below is the process of the use
Ph=peaks (256) * 3; % the preset original phase
Mu=0.5;
% noise coefficientWhose=rands (256256). * mu. * PI;
% noisePh=ph + noise; Have noise added to the % of the default primitive phase
U=exp (j * ph); Ph0=Angle (U); % the corresponding package phase
/r, c=size (ph0);
Figure, imshow (ph0, [])
Unph=ph0; % the default solution package after phase
Unph (1, :)=unwrap_one_d (ph0 (1, :), ph0 (1, 1), PI); % to complete the first line element solution package operation
For n=1: c
% below to complete the first n columns element solution package operation, the initial phase values for the column on the first line element solution of wrapped phase values
Unph (:, n)=unwrap_one_d (ph0 (:, n), unph (1, n), PI);
End
Figure, imshow (unph, [])
Understand run to see where is wrong

CodePudding user response:

The 18th and 19th line is less a end, U=exp (j * ph); Ph0=Angle (U); J variable is not ah,
  • Related