Main Content

interpft

説明

y = interpft(X,n)X の関数値のフーリエ変換を内挿し、等間隔に配置された n 個の点を生成します。interpft はサイズが 1 ではない最初の次元で動作します。

y = interpft(X,n,dim) は、次元 dim に沿って処理します。たとえば、X が行列の場合、interpft(X,n,2)X の行で動作します。

すべて折りたたむ

FFT 法を使用して 1 次元データを内挿し、結果を可視化します。

区間 [0,3π] に関数 f(x)=sin2(x)cos(x) のサンプル点をいくつか生成します。間隔 dx を使用して、データが必ず等間隔になるようにします。サンプル点をプロットします。

dx = 3*pi/30;
x = 0:dx:3*pi;
f = sin(x).^2 .* cos(x);
plot(x,f,'o')

Figure contains an axes object. The axes contains a line object which displays its values using only markers.

FFT 内挿を使用して、200 個のクエリ点での関数値を検索します。

N = 200;
y = interpft(f,N);

内挿データの間隔を、サンプル点の間隔から dy = dx*length(x)/N により計算します。ここで N は内挿点の数です。y のデータを打ち切り、サンプリング密度を x2 と一致させます。

dy = dx*length(x)/N;
x2 = 0:dy:3*pi;
y = y(1:length(x2));

結果をプロットします。

hold on
plot(x2,y,'.')
title('FFT Interpolation of Periodic Function')

Figure contains an axes object. The axes object with title FFT Interpolation of Periodic Function contains 2 objects of type line. One or more of the lines displays its values using only markers

正規分布した乱数の独立した 3 つのデータ セットを生成します。データは正の整数 (1:N) でサンプリングされるものと仮定します。データ セットを行として行列に格納します。

A = randn(3,20);
x = 1:20;

行列の行をそれぞれ 500 個のクエリ点で内挿します。dim = 2 を指定し、interpftA の行で機能するようにします。

N = 500;
y = interpft(A,N,2);

内挿データの間隔 dy を計算します。y のデータを打ち切り、サンプリング密度を x2 と一致させます。

dy = length(x)/N;
x2 = 1:dy:20;
y = y(:,1:length(x2));

結果をプロットします。

subplot(3,1,1)
plot(x,A(1,:)','o');
hold on
plot(x2,y(1,:)','--')
title('Row 1')

subplot(3,1,2)
plot(x,A(2,:)','o');
hold on
plot(x2,y(2,:)','--')
title('Row 2')

subplot(3,1,3)
plot(x,A(3,:)','o');
hold on
plot(x2,y(3,:)','--')
title('Row 3')

Figure contains 3 axes objects. Axes object 1 with title Row 1 contains 2 objects of type line. One or more of the lines displays its values using only markers Axes object 2 with title Row 2 contains 2 objects of type line. One or more of the lines displays its values using only markers Axes object 3 with title Row 3 contains 2 objects of type line. One or more of the lines displays its values using only markers

入力引数

すべて折りたたむ

入力配列。ベクトル、行列または多次元配列として指定します。X のデータは独立変数の等間隔でサンプリングされるものと見なされます。interpft は周期的データに最も効果的です。

データ型: single | double
複素数のサポート: あり

点の数。正の整数スカラーとして指定します。

データ型: single | double

演算の対象の次元。正の整数のスカラーとして指定します。値を指定しない場合、既定値は、サイズが 1 ではない最初の配列の次元です。

  • interpft(X,n,1)X の列を内挿します。

    interpft(X,n,1) column-wise computation

  • interpft(X,n,2)X の行を内挿します。

    interpft(X,n,2) row-wise computation

例: interpft(X,n,3)

出力引数

すべて折りたたむ

内挿点。ベクトル、行列または多次元配列として返されます。length(X,dim) = m であり、かつ X のサンプリング間隔が dx である場合、y の新しいサンプリング間隔は dy = dx*m/n となります。ここで n > m です。

dim が指定されている場合、interpft は次元 dim でパディングまたは切り捨てにより X の長さを n にし、size(y,dim) = n となるようにします。

アルゴリズム

関数 interpft は FFT 法を使用します。元のベクトル x は、fft を使ってフーリエ領域に変換され、より多くのサンプル点を使って逆変換されます。

拡張機能

バージョン履歴

R2006a より前に導入

参考

|