title: Octave - Mark zero crossings with an red X mark
body: <p>Hi have made this code to plot a function.</p>
  
  <p><strong>I need to mark with an red X all the crossings between x = 0 and the blue wave line in the graph.</strong></p>
  
  <p>I have made some tries but with '-xr' in the plot function but it places X marks out of the crossings.</p>
  
  <p>Anyone knows how to do it. Many thanks.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>% entrada
  a = input('Introduza o valor de a: ');
  % ficheiro fonte para a função
  raizes; 
  % chamada à função
  x = 0:.1:50;
  or = x;
  or(:) = 0;
  h = @(x) cos(x);
  g = @(x) exp(a*x)-1;
  f = @(x) h(x) - g(x);
  zeros = fzero(f,0);
  plot(x,f(x));
  hold on
  plot(zeros,f(zeros),'-xr')
  hold off
  </code></pre>
  
  <p><strong>Graph (it only marks one zero, i need all the zero crossings):</strong></p>
  
  <p><a href="https://i.stack.imgur.com/MtVgd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MtVgd.jpg" alt="enter image description here"></a></p>