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