title: Resampling of time signal in MATLAB
body: <p>I want to resample my signal with to new time. Currently the sampling time of my signal is <code>0.01s</code>, and the size of my signal and time array is <code>1*90001</code>.</p>
  
  <p>I am trying to use <code>resample(x,p,q)</code> in MATLAB, but I am a little bit confused.</p>
  
  <p>Can somebody suggest the right way to use this function and how to resample my data to rate of <code>0.02s</code> instead of <code>0.01s</code>?</p>
  
  <p><strong>Code</strong> - this is how I am trying to use <code>resample</code>, with example data.</p>
  
  <pre><code>t = [0:0.03:1];
  x = sin(4*pi*t);
  y = resample(x, 1, 2);
  ty = resample(t,1,2);
  
  figure (1);
  stem(ty, y, 'r*');
  hold on;
  stem(t,x,'b')
  hold off
  </code></pre>
  
  <p><strong>Updated Code :</strong></p>
  
  <pre><code>t = [0 2 3 7 8 9 10 11 12 17 18 19 20 24 25 26 27 28 29 31 32 33 35 37 41 ];
  A = [0 0 1 2 3 5.2 0 -1.4 0 2 2.7 2 2.3 6 7.3 0 0 -8.6 0 1 1 2.5 3 4.8 2];
  plot(t,A)
  % Tx = min(diff(t));
  Tx = 1:0.1:25;
  B = interp1(t,A,Tx); %re-make example data to have decimal points on the x-axis
   y = resample(B, 2, 1); 
   T = 0.05;
   Ty = T / (2 / 1); 
   ty = (0:length(y)-1)*Ty;
  % A = interp1(t,ref,t2);
  % A = ref;
  figure 
  plot(Tx,B,'b')
  hold on
  plot(ty,y,'r')
  plot(t,A,'g')
  hold off
  </code></pre>