Numerical methods Arduino

Hello guys I have some problem with my program code. I have to add some kind of numerical method (e.g FFT, interpolation) in my HC-SR04 Ultrasonic Sensor. I know it doesnt make any sense cause HC-SR04 is fast enough without any NM but my teacher will kill me if i woudnt add something here. I was trying add something for about 3 days and i failed, but i'm sure that for some of You its about 5 minutes of work. So I will be very very gratefull if someone would modify my code and add some NM.
Peace and love to all helpfull folks.

#include <LiquidCrystal.h>
 
int TX = 7; 
int RX = 8; 
int CM;     
long TIME;  
 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
void setup()
{
  lcd.begin(16,2);
  pinMode(TX, OUTPUT);
  pinMode(RX, INPUT);
}
 
void loop()
{
  pomiar_odleglosci();
  lcd.clear();
  lcd.setCursor(0,0); 
  lcd.print("Czas: ");  /*time*/
  lcd.print(TIME);
  lcd.print("us");
  
  
  
  lcd.setCursor(0,1);
  lcd.print("Do celu: ");     /*distance*/
  lcd.print(TIME / 58);
  lcd.print("cm");
  delay(500);
}
 
void pomiar_odleglosci ()          /*distance measure*/
{
  
  digitalWrite(TX, HIGH);
  delayMicroseconds(10);
  digitalWrite(TX, LOW);
  TIME = pulseIn(RX, HIGH);
}

statistics might make more sense,

Add a numeric average?
Or take three readings and take the median?
Or use a running average?

My best idea is to do extrapolation. I would took about 10 measure and do extrapolation. I changed my code

void pomiar_odleglosci ()
{
  for(i=0; i<10; i++){ 
  
  
  digitalWrite(TX, HIGH);
  delayMicroseconds(10);
  digitalWrite(TX, LOW);
  TIME[i] = pulseIn(RX, HIGH);
  delay(4);
  }

}

but i dont know how to change void loop

I don't know if I understand what you want to do, but maybe this may help:

void loop()
{
  for(int i=0; i<10; i++){ 
    digitalWrite(TX, HIGH);
    delayMicroseconds(10);
    digitalWrite(TX, LOW);
    TIME[i] = pulseIn(RX, HIGH);
    delay(4);
  }

  lcd.clear();
  lcd.setCursor(0,0); 
  lcd.print("Czas: ");  /*time*/
  lcd.print(TIME);
  lcd.print("us");
  
  lcd.setCursor(0,1);
  lcd.print("Do celu: ");     /*distance*/
  lcd.print(TIME / 58);
  lcd.print("cm");
  delay(500);
}

No, my idea is to put eg approximation function into main loop (void loop) which took my TIME table (10 sygnals), approximate them and then show on LCD mean value of approximate funcion of 10 measures

void pomiar_odleglosci ()          /*distance measure*/
{
  
  digitalWrite(TX, HIGH);
  delayMicroseconds(10);
  digitalWrite(TX, LOW);
  TIME = pulseIn(RX, HIGH);
}

I think rather than vague hand-waving about inappropriate mathematical techniques, your teacher would be more impressed by a simple non-void function.

Maybe its true, but He hardly demands some numerical method instead of correctness of code (i was tried to write code as simple as it could be).