title: if a<x<b in matlab
body: <p>I need any help for Matlab's thinking method.Ithink I can explaine my problem with a simple example better. Let's say that I have a characteristic function x=y+x0, x0's are may starting values.Then I want to define my function in a grid.Then I define a finer grid and I want to ask him if he knows where an arbitrary (x*,y*) is.To determine it mathematically I should ask where the corresponding starting point (x0*) is. If this startig point stay between x(i,1)
  
  <pre><code>    clear
      %%%%%%%%%%&amp;First grid%%%%%%%%%%%%%%%%%%%%
      x0=linspace(0,10,6);
      y=linspace(0,5,6);
      for i=1:length(x0)
          for j=1:length(y)
              x(i,j)=y(j)+x0(i);
  
      %%%%%%%%%%%%%%%%%%%Second grid%%%%%%%%%%%%%%%%%%
      x0fine=linspace(0,10,10);
      yfine=linspace(0,5,10);
      for p=1:length(x0fine)
          for r=1:length(yfine)
              xfine(p,r)=yfine(r)+x0fine(p);
      if (x(i,1)&lt;xfine(p,1)')&amp;(x0fine(p,1)'&lt;x(i+1,1))%%%%I probabliy have my first mistake %here
  %             if y(j)&lt;yfine(r)&lt;y(j+1)
  %                 xint(i,j)=(x(i,j)+x(i,j+1)+x(i+1,j)+x(i+1,j+1))./4;
  %             else 
  %                xint(i,j)= x(i,j);
              %end
  end
  end
  end
  end
  </code></pre>