L infty for a function

I have a polynomial p(x) of some degree N>=0 and I need to compute, on some interval [x1,x2], the L_{\infty} norm of the difference sin(x)-p(x).
I try to work in this way, I define sin(x) as v=@(s)sin(s) and p(X) some linear polynomial, e.g. p=@(s)2*s+1. Then how I can continue ?
p.s. I can not take values of the variable x as a vector and take the function norm(...,inf).

1 件のコメント

Rena Berman
Rena Berman 2017 年 3 月 9 日
(Answers Dev) Restored edit

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

回答 (1 件)

Matt J
Matt J 2016 年 10 月 5 日
編集済み: Matt J 2016 年 10 月 5 日

0 投票

Apply FMINBND to -abs(sin(x)-p(x)).
Or apply FMINSEARCH to the same with an initial guess x0 of the minimizing x.
I can not take values of the variable x as a vector and take the function norm(...,inf).
Even if you ultimately need a continuous-space solution, this is still a good way of generating a reliable initial guess for fminsearch, or similar.

1 件のコメント

Matt J
Matt J 2016 年 10 月 5 日
編集済み: Matt J 2016 年 10 月 5 日
Do not use syms. fminsearch and fminbnd are numerical solvers. You must pass them function handles rather than symbolic expressions.

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

カテゴリ

ヘルプ センター および File ExchangeNumerical Integration and Differential Equations についてさらに検索

タグ

タグが未入力です。

質問済み:

A B
2016 年 10 月 5 日

コメント済み:

2017 年 3 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by