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.$$
Asked
Active
Viewed 51 times
1 Answers
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
-
Error: File: my_fun.m Line: 4 Column: 1 Function definitions are not permitted in this context. any remedy for? – Riaz Apr 24 '19 at 10:21
-