function z = magphase_to_complex(mag, phase_deg)

    % Ensure column vectors (optional but safe)
    mag = mag(:);
    phase_deg = phase_deg(:);

    % Convert degrees to radians
    phase_rad = deg2rad(phase_deg);

    % Form complex array
    z = mag .* exp(1i * phase_rad);

end
