Matlab code for creating the function

52 Views Asked by At

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.$$

1

There are 1 best solutions below

2
On BEST ANSWER

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