Should sinc() be Implemented with sinpi()?

2 Ansichten (letzte 30 Tage)
Paul
Paul am 25 Jan. 2023
Kommentiert: Paul am 3 Feb. 2023
Here are the relevant lines that implement sinc
dbtype sinc.m 24:27
24 i=find(x==0); 25 x(i)= 1; % From LS: don't need this is /0 warning is off 26 y = sin(pi*x)./(pi*x); 27 y(i) = 1;
Should line 26 now be implemented with sinpi?
If concerned with changing results of existing code, perhaps an optional input to specify implementation in terms of sinpi instead of sin?

Akzeptierte Antwort

Ganesh Thambhahalli Satyen
Ganesh Thambhahalli Satyen am 25 Jan. 2023
Bearbeitet: Ganesh Thambhahalli Satyen am 25 Jan. 2023
Hey Paul,
From your question, I understand that you are requesting for an enhancement in the sinc function to have the following:
  1. The existing sinc function code should replace sin(pi*x) with sinpi(x).
  2. An optional input should be introduced for specifying whether the sinc computation is using sin or sinpi.
If so, I would like to let you know that an enhancement request about considering converting "sinc" to use sinpi for better accuracy has been submitted to our developers.
Thank you for your feedback.
  1 Kommentar
Paul
Paul am 3 Feb. 2023
Thanks for the response. matlabFunction is another candidate for consideration
syms x
matlabFunction(sin(2*sym(pi)*x))
ans = function_handle with value:
@(x)sin(x.*pi.*2.0)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by