title: GNU Octave Code Equivalent in C/C++
body: <p>I have some GNU octave/Matlab code that I would like to translate into C or C++. I can handle most of this translation but I don't know what the line <code>x1=0:1:pts-1;</code>would translate to in C code. If i understand correctly it is a Range type in Octave but i'm not sure what data type in C or C++ would support that same functionality.
  The Full script is:</p>
  
  <pre><code>pkg load signal
  fs = 48000;
  fc=18300;
  rlen=10;
  ppiv=100;
  beta=9.0;
  apof=0.9;
  apobeta=0.7;
  
  pts = ppiv*rlen+1;
  
  x1=0:1:pts-1;%this line here!!!!
  
  x2=rlen*2*(x1-(pts-1)/2 +0.00001)/(pts-1); % and the the usage of x1 in this line
  x3=pi*fc/fs*x2;
  h=sin(x3)./x3;
  w=kaiser(pts,beta);
  g=w.*h;
  
  aw = 1-apof*kaiser(pts,apobeta);
  g=aw.*g;
  g=g/max(g);
  
  
  
  figure(1);
  subplot(1,2,1);
  plot(x2/2,g);
  axis([-rlen/2 rlen/2 -0.2 2.0002]);
  %xlabel(“Time in Sampling Intervals”);
  %title(‘Bandlimited Impulse’);
  subplot(1,2,2);
  zpad=20;
  g2=[g;zeros((zpad-1)*pts,1)];
  wspec=abs(fft(g2));
  wspec=max(wspec/max(wspec),0.00001);
  fmax=60000;
  rng = round(rlen*zpad*fmax/fs);
  xidx = 0:1:rng;
  semilogy(fmax/1000*xidx/rng,wspec(1:(rng+1)));
  %xlabel(‘Frequency in kHz’);
  %title(‘amplitude spectrum’);
  grid;
  
  hold;
  plot([20 20],[0.00001,1]);
  plot([fs/1000-20 fs/1000-20], [0.00001 1]);
  plot([fs/1000 fs/1000], [0.00001 1]);
  hold off;
  </code></pre>
  
  <p>So what i am looking for Is either a code snippet or some resource of how to deal with this conversion.</p>
  
  <p>Thanks in advance</p>