フィルターのクリア

equation with 90 degree bend

7 ビュー (過去 30 日間)
Emil
Emil 2015 年 8 月 28 日
編集済み: John D'Errico 2015 年 9 月 11 日
Using fitype in curve fitting toolbox I would like to fit a dataset of a known shape to scattered data. The shape is that of a linear line of slope 1 with a 90 degree bend resulting in a slope -1. For the life of me I can't write a proper equation to do the job. Can someone help?
  1 件のコメント
Ian Burelle
Ian Burelle 2015 年 9 月 11 日
I don't think there is a continuous smooth equation for that. It would have to be piecewise.

サインインしてコメントする。

採用された回答

John D'Errico
John D'Errico 2015 年 9 月 11 日
編集済み: John D'Errico 2015 年 9 月 11 日
Trivial?
What equation has a slope of +1, followed by a slope of -1, is continuous, etc? In its most general form, this will suffice.
f(x) = a + abs(x-b)
a is a vertical offset, b the location of the break (transition) point in the slope. Be slightly careful in your choice of b, as if it was outside the range of the data, the optimization will have problems.
Also, be careful in that you cannot add another coefficient in front of the absolute value, as that would blow away the required slopes.
And finally, of course the functional form I have written is not differentiable. But it is continuous, and has the exact properties requested.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 8 月 29 日
編集済み: Walter Roberson 2015 年 8 月 29 日
What is an "equation" for this purpose? The derivative is clearly not continuous so you cannot write in terms of linear functions or exponential or trig.
If equation allows Heaviside you could use that to code the piecewise contributions.
Are you aware that fittype() does not require an equation? You can pass it an anonymous function http://www.mathworks.com/help/curvefit/fittype.html#inputarg_anonymousFunction
And really what that means is that you can pass a function handle. Including a handle to a real function that uses logical indexing to determine which case applies for each input value.

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by