clear alln = 1for k = 0:.1:6 x(n) = k if (2 <= x(n))&&(x(n) <= 4) y(n) = 2*k else y(n) = -5*k end n=n+1endplot(x,y)
MATLAB: I am trying to accomplish this same task using the find() command but I’m not sure how.
findMATLABpiecewise function
Related Question
- How to determine coordinate from graph
- Finding index and count of values in an interval
- Splitting a vector into ‘on’ periods
- How to find the indices of the repeating elements in an array with respect to another array
- How to explicitly specify which lines to include in the legend of a plot in MATLAB 7.7 (R2008b)
Best Answer