Products & Services Solutions Academia Support User Community Company

Learn more about Spline Toolbox   

subplus - Positive part

Syntax

xp = subplus(x)

Description

xp = subplus(x) returns , 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.

Examples

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)

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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