How to put max function in symbolic function
6 次查看(过去 30 天)
显示 更早的评论
I want to make a symbolic function where
f(x)=max(0,x)={0 x<0
x x≥0 }
how to do it?
syms x
f = max(0,x)
It gives me an error: Input arguments must be convertible to floating-point numbers.
0 个评论
回答(1 个)
Birdman
2021-1-13
Why would you try to name it as max? Simply, piecewise function in Symbolic toolbox would help you:
syms x
f(x)=piecewise(x<0,0,x>=0,x);
ıf you want to plot for specific inputs to test the function
x=-2:0.1:2;%random input
plot(x,f(x))
1 个评论
Mohamed Gaballah
2021-1-13
Isn't there an equivilant in Matlab 2016a , as it gives me "Undefined function or variable 'piecewise'."
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!