Piece-wise Fourier series / Inverse Fourier series

버전 1.0.12 (4.78 KB) 작성자: Ryan Black
Computes the Fourier series coefficients of an arbitrarily defined piece-wise polynomial, or vice versa with visualization.
다운로드 수: 45
업데이트 날짜: 2020/9/3

라이선스 보기

Forward Fourier series:
For function call

[R,r0,T] = fspw(c,cK,T)

Input: (see theory)
c is standard form polynomial coefficient matrix for a piece-wise polynomial
cK is the highest degree, non-piece-wise coefficient
T is the total interval measure

Output: (see theory)
R is corresponding standard form frequency domain coefficient matrix
r0 is the DC coefficient
T is the total interval measure, preserved.

Given a piece-wise polynomial function in Heaviside form defined by a real-valued coefficient matrix c_{q,k} and measured interval 0<x<T:

p(x) = \sum_{q=0}^{Q-1}[u(x-qT/Q)-u(x-(q+1)T/Q] (\sum_{k=0}^{K-1}c_{q,k}x^k) + c_{K}x^K

Function outputs the Fourier coefficients using a complex basis defined by a real-valued coefficient matrix R_{k,q}

p(x) = \sum_{n=-\infty}^{+\infty}Q_{n}e^{2\pi i n x/T}

where

Q_{n} = \begin{cases} \sum_{k=0}^{K-1}[1/(2\pi i n)]^{k+1}(\sum_{q=0}^{Q-1}R_{k,q}e^{2\pi i n q/Q}), & n \neq 0 \\ r_{0}, & n=0 \end{cases}

Inverse Fourier series:
For function call

[c,cK,T] = ifspw(R,r0,T)

Input:
R is standard form frequency domain coefficient matrix for a piece-wise polynomial
r0 is the DC coefficient
T is the total interval measure, preserved.

Output:
c is corresponding standard form polynomial coefficient matrix
cK is the highest degree, non-piece-wise coefficients
T is the total interval measure, preserved

Function output is a piece-wise polynomial function in Heaviside form defined by a real-valued coefficient matrix c_{q,k} and measured interval 0<x<T:

p(x) = c_{q,K}x^{K} + \sum_{q=0}^{Q-1}[u(x-qT/Q)-u(x-(q+1)T/Q] (\sum_{k=0}^{K-1}c_{q,k}x^{k})

Function input is the Fourier coefficients using a complex basis defined by a real-valued coefficient matrix R_{k,q}

p(x) = \sum_{n=-\infty}^{+\infty}Q_{n}e^{2\pi i n x/T}

where

Q_{n} = \begin{cases} \sum_{k=0}^{K-1}[1/(2\pi i n)]^{k+1}(\sum_{q=0}^{Q-1}R_{k,q}e^{2\pi i n q/Q}), & n \neq 0 \\ r_{0}, & n=0 \end{cases}

Plotter function:
For function call

fspwplotter(R,r0,c,cK,T)

Example 1 Forward (Stair-step Wave Fourier Expansion):
c = [1;.8;.6;.4;.2;0];
cK=0;
T = 7;
[R,r0,T] = fspw(c,cK,T);
fspwplotter(R,r0,c,cK,T)

Example 2 Inverse
R = [1 3 10 1 -4 -10; -10 4 2 5 5 5 ; -20 100 10 -10 -1 -4 ; 10 -4 -20 -30 2 3]
r0 = 0;
T = 7;
[c,cK,T] = ifspw(R,r0,T);
fspwplotter(R,r0,c,cK,T)

인용 양식

Ryan Black (2024). Piece-wise Fourier series / Inverse Fourier series (https://www.mathworks.com/matlabcentral/fileexchange/79415-piece-wise-fourier-series-inverse-fourier-series), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2020a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.12

ok hopefully final update for a while

1.0.11

keep adding comments and making the notation consistent between all the sub-functions.

1.0.10

i think i may have forgot to update last time

1.0.9

for Quora

1.0.8

split cK from coefficient matrix as a 2nd case condition

1.0.7

added to descriptiion

1.0.6

accidentally displayed an output matrix I was trying to hide.

1.0.5

Added inverse Fourier series function and plotter function to same File exchange contribution.

1.0.4

Added transform, inverse transform and plotter function all to same File exchange contribution.

1.0.3

description edit

1.0.2

description edit

1.0.1

Updated description.

1.0.0