A system for quantifying timing discrepancies between a patient's inspiratory effort and ventilatory assist to the patient by a ventilator, characterized in that it comprises: a computer interface operatively connected to a mechanical ventilator to provide a measurement signal reflecting a pressure of air supplied by the ventilator to the patient; means for acquiring (12, 13, 16, 18, 29) an electrical activity signal representing a neural inspiration of the patient; and a computer processor for: determining a start time and an end time of the ventilatory assist based on the measurement signal indicative of the pressure of air supplied by the mechanical ventilator to the patient; determining an early ventilatory assist trigger error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, a start time of the neural inspiration with the start time of the ventilatory assist, determining a late ventilatory assist trigger error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the start time of the neural inspiration with the start time of the ventilatory assist, determining an early ventilatory assist cycling-off error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the end time of the neural inspiration with an end time of the ventilatory assist, determining a late ventilatory assist cycling-off error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the end time of the neural inspiration with the end time of the ventilatory assist, wherein the computer processor: determines that the ventilatory assist is synchronized when the early or late ventilatory assist trigger error is smaller than a first threshold and the early or late ventilatory assist cycling-off error is smaller than a second threshold; and implements a defragmentation ignoring sub-ventilatory efforts in which the pressure of air supplied by the ventilator to the patient is less than a pressure value of 150 Pa and by ignoring sub-ventilatory efforts in which the electrical activity signal representing the neural inspiration of the patient has a value less than a diaphragmatic electrical activity value (EAdi) of 0.15μV. a computer interface operatively connected to a mechanical ventilator to provide a measurement signal reflecting a pressure of air supplied by the ventilator to the patient; means for acquiring (12, 13, 16, 18, 29) an electrical activity signal representing a neural inspiration of the patient; and a computer processor for: determining a start time and an end time of the ventilatory assist based on the measurement signal indicative of the pressure of air supplied by the mechanical ventilator to the patient; determining an early ventilatory assist trigger error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, a start time of the neural inspiration with the start time of the ventilatory assist, determining a late ventilatory assist trigger error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the start time of the neural inspiration with the start time of the ventilatory assist, determining an early ventilatory assist cycling-off error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the end time of the neural inspiration with an end time of the ventilatory assist, determining a late ventilatory assist cycling-off error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the end time of the neural inspiration with the end time of the ventilatory assist, determining a start time and an end time of the ventilatory assist based on the measurement signal indicative of the pressure of air supplied by the mechanical ventilator to the patient; determining an early ventilatory assist trigger error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, a start time of the neural inspiration with the start time of the ventilatory assist, determining a late ventilatory assist trigger error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the start time of the neural inspiration with the start time of the ventilatory assist, determining an early ventilatory assist cycling-off error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the end time of the neural inspiration with an end time of the ventilatory assist, determining a late ventilatory assist cycling-off error by comparing, based on the electrical activity signal representing the neural inspiration of the patient, the end time of the neural inspiration with the end time of the ventilatory assist, determines that the ventilatory assist is synchronized when the early or late ventilatory assist trigger error is smaller than a first threshold and the early or late ventilatory assist cycling-off error is smaller than a second threshold; and implements a defragmentation ignoring sub-ventilatory efforts in which the pressure of air supplied by the ventilator to the patient is less than a pressure value of 150 Pa and by ignoring sub-ventilatory efforts in which the electrical activity signal representing the neural inspiration of the patient has a value less than a diaphragmatic electrical activity value (EAdi) of 0.15μV.