Heading reference vector from ardupilot vs GPS

I need to calculate the heading unit vector for the quadcopter in NED coordinate frame. I am taking roll,pitch and yaw of from mavlink message and use it to calculate the rotation matrix by applying the sequence (Yaw * pitch * roll). I then take the inverse to get the copter body frame unit vectors.

Since I want to convert to NED from this body frame I apply a Yaw rotation of (-90 degrees) based on this https://en.wikipedia.org/wiki/Axes_conventions#/media/File:RPY_angles_of_airplanes.png .
The unit vector I get from this matrix is different from the North unit vector I get from GPS coordinates (by using matlab dcmecef2ned(latitude,longitude) function.
Is this approach for getting heading vector correct and what could be the reason for difference in these two vectors.