--> //initializations

--> p=30 //KN/m^3 
 p  = 

   30.


--> Yw=10 //KN/m^3 (unit weight of water)
 Yw  = 

   10.


--> Y1=20 //KN/m^3 (unit weight of sand)
 Y1  = 

   20.


--> Y2=18 //KN/m^3 (unit weight of clay)
 Y2  = 

   18.


--> T1=4 //m (thickness of sand layer)
 T1  = 

   4.


--> Ho=2.5 //m (thickness of clay layer)
 Ho  = 

   2.5


--> eo=1.3 // (void ratio in clay)
 eo  = 

   1.3


--> Cc=0.22 // (coefficient of compressibility)
 Cc  = 

   0.22


--> //calculations

--> Ro=(T1*Y1)+((Ho/2)*Y2) //(initial pressure)
 Ro  = 

   102.5


--> sf=((Cc*Ho)/(1+eo))*((log((Ro+p)/Ro))/2.303) // (final settlement of clay layer)
 sf  = 

   0.0266563


--> Sf=sf*100
 Sf  = 

   2.665633


--> Ro1=(T1*(Y1-Yw))+((Ho/2)*(Y2-Yw)) //(pressure when water table rise)
 Ro1  = 

   50.


--> sf1=((Cc*Ho)/(1+eo))*((log((Ro1+p)/Ro1))/2.303) // (settlement when water table rise)
 sf1  = 

   0.0488025


--> Sf1=sf1*100
 Sf1  = 

   4.8802506


--> //results

--> printf('final settlement of clay layer=%f',Sf) //cm
final settlement of clay layer=2.665633
--> printf('settlement when water table rise=%f',Sf1) //cm
settlement when water table rise=4.880251