How to make multiple terrains match together?

I’m working on a procedural terrain generation using a Simplex noise algorithm and placing 9 tiles(terrains) in a 3x3 square.
The problem is that the terrains aren’t matching together like in the image:

38110-capture.png

And this is the code which generates the heights for every tile:

private void GenerateHeights (int tileZ, int tileX)
{

if (tiles [tileZ, tileX] == null)
    return;

Terrain tempTerrain = tiles [tileZ, tileX].terrainTile;

int width = tempTerrain.terrainData.heightmapWidth;
int height = tempTerrain.terrainData.heightmapHeight;

float xRatio = frequency / (float)width;
float zRatio = frequency / (float)height;

float[,] heights = new float[height, width];

for (int z = 0; z < height; z++) {
   for (int x = 0; x < width; x++) {
     float noiseX = (x + tempTerrain.transform.position.x) * xRatio;
     float noiseZ = (z + tempTerrain.transform.position.z) * zRatio;
     heights [z, x] = noiseGenerator.Noise (noiseX, noiseZ) * detailScale;
   }
}

 tempTerrain.terrainData.SetHeights (0, 0, Normalize (heights));
}

If i comment this function i get 9 perfectly aligned square plane tiles so the initial alignement is correct…
I found this script (stitchscape) which i think i could solve my problem but it is not free in the asset store

I forgot to mention that i already call the SetNeighbors function for every tile and this improves a little the result but it’s not enough

Buy Stitchscape

For your width and height you should use heightmapResolution values. Here’s another similar question: Aligning simplex noise-generated terrain - Unity Answers