title: increase / decrease the frequency of a signal using fft and ifft in matlab / octave
body: <p>I'm trying to increase / decrease the frequency of a signal using fft and ifft.  The first plot is <strong>1hz and the second plot is 2hz which I'm trying to get by altering the fft and ifft values</strong>.</p>
  
  <p>I can go between the frequency domain and time domain but how can I increase or decrease the frequency of the signal using fft / ifft?</p>
  
  <p>Note: Yes I know I could change the frequency by changing the frequency value of the equation but I'm just using that as a test signal.  The signals I will be using won't have equations they will be imported.</p>
  
  <p><img src="https://i.stack.imgur.com/NziJO.png" alt="Plot 1hz"></p>
  
  <p><strong>The plot with 2hz is what I'm trying to get by adjusting the fft and ifft values</strong></p>
  
  <p><img src="https://i.stack.imgur.com/qIgQT.jpg" alt="Plot 2hz which I trying to get by adjusting the fft and ifft"></p>
  
  <p>Example code below:</p>
  
  <pre><code>clear all,clf
  
  Fs = 100;% Sampling frequency
  t=linspace(0,1,Fs);
  
  %1a create signal
  ya = .5*sin(2*pi*1*t); 
  
  %2a create frequency domain
  ya_fft = fft(ya);
  
  mag = abs(ya_fft);
  phase = unwrap(angle(ya_fft));
  ya_newifft=ifft(mag.*exp(i*phase));
  
  %3a frequency back to time domain
  ya_ifft=real(ifft(ya_fft));
  
  %1b time domain plot
  subplot(2,2,1),plot(t,ya)
  title('1 Orginal Signal Time domain')
  ylabel('amplitude')
  xlabel('Seconds')
  
  %2b frequency domain plot.
  [xfreq,yamp]=rtplotfft(ya,Fs);
  yamp2=(yamp(:,1)/max(abs(yamp(:,1)))*1); %keep at 1, amplitude levels adjustied in loop below
  subplot(2,2,2),plot(xfreq,yamp) 
  title('2 Frequency domain')
  xlabel('Frequency (Hz)')
  ylabel('amplitude')
  </code></pre>
  
  <p>Ps: I'm using octave 3.8.1 which works with matlab</p>