I am looking for a phase unwrap code.
Tried my own but can't get it to work 100%.

In MATLAB there is a built-in function that does it but I need it in VB.

what it does is:

if Z(f) is a complex function, phase(f) = atn[Imag(z(f))/Real(z(f))].
atn values are bounded by +/- 180 in deg (or +/-pi in radians).
For certain cases, where f is defined on a large range, phase(f) is not continues since there are multipla values of f for which phase(f) has the same value.

unwrapping means that instead of 'returning' to the basic trigonometric circle (a modulus 360 operation) it lets the value (of atn) be a continous function of f.