www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ComputationResultinginZeroValuedImaginaryPartExample.m

    %% Computation Resulting in Zero-Valued Imaginary Part  

%% 
% Define two complex scalars, |x| and |y|. 
x=3+4i;
y=5-4i;  

%% 
% Determine whether the addition of two complex scalars, |x| and |y|, is
% real.
A = x+y 

%%
% MATLAB(R) drops the zero imaginary part.  

%%  
isreal(A) 

%%
% |A| is real since it does not have an imaginary part.