title: Finding correlation of two data variables, matlab (Concept)
body: <p>I have a very large data.Its  too big to post here. So really don't have idea how to ask this question? I'm using matlab.</p>
  
  <pre><code>mat = [time_days temperature, change_in_mm] %
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/KfNe4.jpg" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/rHlTa.jpg" alt="enter image description here"></p>
  
  <p>I want to find cross-correlation between temperature &amp; change_in_mm with respect to time.</p>
  
  <p>Basic idea is to do it in frequency domain. </p>
  
  <pre><code>f_data = fft(t_data, N)
  </code></pre>
  
  <ol>
  <li>How should I select <em>N</em>?</li>
  <li>Should I convert both temperature &amp; change_in_mm into frequency domain?</li>
  </ol>
  
  <p>There should be relation between <code>temperature</code> and <code>change_in_mm</code>. I want to see that correlation between <code>temperature</code> and <code>change_in_mm</code> during winter and summer as well as over day and night.  </p>
  
  <p>What should be my next steps?Can any body guide me in this regard. </p>
  
  <p>%----------------------Edited-----------------------------------%</p>
  
  <p>I tried it already but can't understand the meaning of graph. </p>
  
  <pre><code>R=xcorr(temperature, change_in_mm);
  N = length(temperature); %// or N = length(change_in_mm)
  R = R(N + 1:end);
  
  figure;
  plot(R,'r')
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Wj6OB.jpg" alt="enter image description here"></p>