0

Matlab code for creating the function $y:[-10,10] \rightarrow \mathbb R$ defined by $$y(x)=\left\{\begin{array}{ll}0 & x \leq -10^{-6}\\ x+10 x^9& -10^{-6}<x< 10^{-6}\\ x&x \geq 10^{-6} \end{array}\right.$$

Riaz
  • 2,174

1 Answers1

2

Here is the code for this simple function.

function y = my_fun(x)

  if x<=-1e-6
    y =0;
  elseif x>-1e-6 && x<1e-6
    y= x+10*x^9;
  elseif x>=1e-6
    y = x;
  end

end

Mdoc
  • 2,116