i keep getting Array indices must be positive integers or logical values.
Show older comments
i keep getting Array indices must be positive integers or logical values and i have no idea how to slove this. i even trying looping it
x = linspace(-3,5,100)'
plot(x,mywierdfcn(x))
function f = mywierdfcn (x)
if x > 2
f(x) =x.^2;
else x <= 2
f(x) = 2*x;
end
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!