You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: PVWF_components.m
    path of file: ./repos/celes/src/mathematics
    
    the code of the file until where you have to start completion: %  Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS)
%                      Giacomo Mazzamuto (LENS)
%  All rights reserved.
%
%  Redistribution and use in source and binary forms, with or w
    
function [E_components, H_components] = PVWF_components(R,k,n,alpha,beta,pol)
% alpha, beta need to be row vectors
% R need to be Nx3

kvec = k*[sin(beta).*cos(alpha);sin(beta).*sin(alpha);cos(beta)];
E = exp(1i*R*kvec);
H = -1i*n.*E;
if pol==1  % TE
    % E_alpha = [-sin(alpha);cos(alpha);0];
    Ex = -sin(alpha).*E;
    Ey = cos(alpha).*E;
    Ez = zeros(size(E),'like',E);
    Hx = 1i*(-cos(alpha).*cos(beta)).*H;    % to check
    Hy = 1i*(-sin(alpha).*cos(beta)).*H;    % to check
    Hz = 1i*sin(beta).*H;                   % to check
else
    % E_beta = [cos(alpha)*kz/k;sin(alpha)*kz/k;-kpar/k];
    Ex = (cos(alpha).*cos(beta)).*E;
    Ey = (sin(alpha).*cos(beta)).*E;
    Ez = -sin(beta).*E;
    Hx = 1i*(-sin(alpha)).*H;               % to check
    Hy = 1i*cos(alpha).*H;                  % to check
    Hz = zeros(size(H),'like',H);           % to check
end