

However, here's a solution similar to that of that uses logical indexing to avoid extra multiplication, addition, and also sets values outside of both ranges to NaN: function y = f(t)
#PLOTTING PIECEWISE FUNCTIONS IN MATLAB CODE#
I use the following code to transform a Matlab code, but the output is not working in Matlab.You can always concatenate the data from your two functions before plotting. (15sqrt (4abs (x))+10) plot (x,y) Sign in to comment. Suppose that I have a piecewise u function. More Answers (0) Sign in to answer this question. I want to export the my maple code to a Matlab code in order to utilize advantages of plots of Matlab. Accepted Answer Star Strider on 2 Link I prefer the anonymous function approach: Theme x (n) n.


I usually piecewise functions in my maple codes.
