trigintpoly
% Suppose that f(t) is a real 2pi-periodic function on the interval [0,2pi]
% and the 1*n vector x is the values of the function f(t) at the n
% equidistant points (n must be even)
% t_j=(j-1)*2*pi/n, j=1,2,...,n.
% The function
% [y , yp , ypp] = trigintpoly (x,s)
% uses fft to find the trigonometric interpolating polynomial that
% interpolates the function f(t) at the n points t_1,t_2,...,t_n. Then the
% function trigintpoly computes the values of the functions f(t), f'(t),
% and f''(t) at the points s (s is an m*1 vector of points), i.e.
% y = f(s), yp=f'(s), ypp=f''(s)
%
%
% Example 1:
% n = 100;
% t = 0:2*pi/n:2*pi-2*pi/n;
% x = cos(2.*t).^3;
% s = [-pi/4,0,pi/2];
% [y , yp , ypp] = trigintpoly (x,s);
%
% The output of this example will be:
% y =
% 4.0326e-17 1 -1
% yp =
% 2.7187e-15 4.5406e-15 2.3184e-15
% ypp =
% -1.9042e-13 -12 12
%
%
% Example 2:
% x = [2,sqrt(2),0,-sqrt(2),-2,-sqrt(2),0,sqrt(2)];
% s = [-pi,0,pi/2,2*pi];
% [y , yp , ypp] = trigintpoly (x,s);
%
% The output of this example will be:
% y =
% -2 2 1.2246e-16 2
% yp =
% 2.4493e-16 0 -2 4.8986e-16
% ypp =
% 2 -2 -1.2246e-16 -2
%
Cite As
Mohamed Nasser (2025). trigintpoly (https://www.mathworks.com/matlabcentral/fileexchange/62521-trigintpoly), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Mathematics > Elementary Math > Polynomials >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |