Questions tagged [piecewise]

"piecewise" may refer to a piecewise function, a piecewise interpolation or a piecewise regression / smoothing.

Defining a piecewise function normally requires writing if ... else ... clause.

Interpolation is inherently piecewise.

Piecewise regression often refers to piecewise linear regression, or segmented regression.

367 questions
0
votes
1 answer

how do I make a numpy.piecewise function of arbitrary length? (having lambda issues)

I'm trying to plot a piecewise fit to my data, but I need to do it with an arbitrary number of line segments. Sometimes there are three segments; sometimes there are two. I'm storing the coefficients of the fit in actable and the bounds on the…
0
votes
0 answers

Is there a way to include labels within a 3D plot?

If I have a plot like RevolutionPlot3D[Piecewise[{{x^2,0
0
votes
1 answer

Nonlinear models with dicotomic affecting to a subset of parameters

I have been working in R with nonlinear models such us: Y = Alpha1*time + Alpha2*sin(2*pi*time/Alpha3) + Alpha4*(-1)^time And I would line whether a bernoulli variable affects to the Alpha1*time and intercept or not. Such bernoulli variable could…
Hector
  • 1
  • 2
0
votes
1 answer

Step functions/Heaviside Functions MATLAB error

So im trying to plot f(t) which is a piecewise function using heaviside and ezplot functions in MATLAB. Now im not very familiar with MATLAB at all. If anyone knows why im getting this error it would be helpful. f =…
Marke
  • 189
  • 4
  • 13
0
votes
1 answer

math expression for a bounded function

I have a bounded function. When x > 1, y = 1; when 0 <= x <= 1, y = x; when x < 0, y = 0. Does anyone know any simple math function to represent y (Do not use piece-wise function). For example, Heaviside function is a similar approach. Thanks
HeyMan
  • 163
  • 2
  • 11
0
votes
1 answer

Matlab drawing points and show values

I have a simple plot question. On x axis, the values are K, say from 2 to 12, discrete. On y axis, the values are C, say from 1 to 10, discrete. My function is piecewise: K if K<2C; K+2C if K>=2C; I want to show the values at points (K,C): (1,1)…
0
votes
1 answer

MATLAB: evaluation of a piecewise polynomial (pchip) with ppval

I am trying to do a pchip interpolation in MATLAB. The interpolation works fine, but when I use the ppval function to check the curve (for plotting) I get an error message, and I cannot figure out what the problem is. I have previously used the…
0
votes
2 answers

Many step picewise function in Matlab?

What is the simplest way to generate piecewise level function like the following Suppose, I know height (y-value) and length (horizontal) of each level in a matrix >> C=[2,4,1,-3;2,1.5,0.7,2.8] C = 2.0000 4.0000 1.0000 -3.0000 …
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
0
votes
1 answer

Audacity - how to set the Nyquist Prompt control rate to match the audio rate?

I wish to use the Nyquist Prompt plugin in Audacity to construct a piece-wise linear waveform of 2048 samples in length. For example, I can generate a square pulse wave by starting with 2048 silent (zero) samples, selecting all, and then invoking…
davidA
  • 12,528
  • 9
  • 64
  • 96
0
votes
2 answers

Obtain equations of segments composing a graph

I have an array of values which, when plotted, give this graph. http://imageshack.us/photo/my-images/15/schermatadel20130215150.png I need to obtain the equations of the segments that compose it, i.e. subdivide this graph into segments (not exactly,…
aliants
  • 77
  • 1
  • 1
  • 7
0
votes
0 answers

How to using dlply to apply breakpoints function of package strucchange to subsets of data ?[R]

Well, I try to do some piecewise regression on my data to find eventual breakpoint for each ID and extract this information. Example: subset of my personal data ID time y 7G009 0 9 7G009 108,33 13 7G009 185,69 16 7G009 …
mat
  • 107
  • 1
  • 6
0
votes
1 answer

Convert a piecewise function to a CSV file using Java

I'm trying to create a Java function that will convert a string containing a piecewise function to a CSV file that can be used for graphing. For example this expression: if (time < 60) then (0.1) else ( if (time > 66.0115) then (0.1) else 1) would…
aknight0
  • 163
  • 2
  • 14
0
votes
1 answer

Problems with Mathematica Plotting using Piecewise

I am trying to plot using piecewise in one of my problems and I have two variables: x and psi. However, the respective functions are only valid for a defined range of "x" and the psi range is the same. I am trying to make a 3D plot of these -- and I…
user1482746
  • 5
  • 1
  • 4
-1
votes
2 answers

Making a piecewise function

I'm trying to write the piecewise a simple piece wise function, yet it won't work when you put in a list. # your code here def pwfun(*args): for x in args: if x < -1: return(-2 * (x + 1)) elif x > 1: …
-1
votes
1 answer

Piecewise Linear Regression in Time Series Data

In R I have produced a piecewise linear regression model and I have the outputs for the model, however, I need help constructing the models formula and I can't find online a formula to calculate the model with two breakpoints. Please let me know if…
1 2 3
24
25