
a1 = 0;
b1 = 25;
noise = floor(a1 + (b1+1-a1)*rand(200,1));

signal(1:20)=100;
signal(21:50)=20;
signal(51:70)=200;
signal(71:90)=130;
signal(91:130)=50;
signal(131:150)=150;
signal(151:175)=70;
signal(176:200)=175;
signal = noise+signal;

function u=ex3template(f,tau,T)
  // computes a minimiser for the given energy functional 
  // f: initial signal
  // tau: time step size
  // T: Number of iterations
  
  N=length(f) // compute length of signal
  
  //set signal to 0 and the boundary values u(1)=10 and u(11)=20
  u(1:N) = 0 
  u(1)=10
  u(N)=20
  
  //compute helper signal
  temp=u
  for t=1:T
    //perform iteration
    
    // Insert your iterative scheme here!
    for i=1:N
      temp(i)= u(i)
    end      
    
    // update u for next iteration
    u=temp  
  end  
endfunction