| Contents | Index |
xp = subplus(x)
xp = subplus(x) returns (x)+, i.e., the positive part of x, which is x if x is nonnegative and 0 if x is negative. In other words, xp equals max(x,0). If x is an array, this operation is applied entry by entry.
Example 1. Here is a plot of the essential part of the subplus function, as generated by
x = -2:2; plot(x,subplus(x),'linew',4), axis([-2,2,-.5,2.5])

Example 2. The following anonymous function describes the so-called hat function:
hat = @(x) subplus(x) - 2*subplus(x-1) + subplus(x-2);
i.e., the spline also given by spmak(0:2,1), as the following plot shows.
x = -.5:.5:2.5; plot(x,hat(x),'linew',4), set(gca,'Fontsize',16)

| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |