Radial basis functions interpolation in 1D ( derivatives)

8 ビュー (過去 30 日間)
nanou
nanou 2019 年 11 月 16 日
回答済み: Shishir Reddy 2025 年 5 月 29 日
How one can obtain the first and second derivatives (with a velocities and accelerations at the beginning and at the end supposed null conditions "V_init = V_final = 0 and A_int = A_final = 0") of the function f (x) modeled by RBF interpolation in 1D. This function is presented in the following link: https://www.mathworks.com/matlabcentral/fileexchange/10056-scattered-data-interpolation-and-approximation-using-radial-base-functions
help me, thank you

回答 (1 件)

Shishir Reddy
Shishir Reddy 2025 年 5 月 29 日
Hi Nanou
To compute the first and second derivatives (velocity and acceleration) of a 1D function interpolated with RBFs and enforce:
  • V_init = V_final = 0
  • A_init=A_final=0
you can modify the interpolation system to include these as additional constraints. Below is a minimal example using Gaussian RBFs.
x = linspace(0, 1, 10)';
y = sin(2*pi*x);
% RBF setup (Gaussian)
epsilon = 5;
phi = @(r) exp(-(epsilon*r).^2);
dphi = @(r) -2*epsilon^2 * r .* exp(-(epsilon*r).^2);
ddphi = @(r) 2*epsilon^2 * (2*epsilon^2 * r.^2 - 1) .* exp(-(epsilon*r).^2);
N = length(x);
A = zeros(N, N);
for i = 1:N
for j = 1:N
A(i,j) = phi(abs(x(i) - x(j)));
end
end
% Boundary points
x0 = x(1); x1 = x(end);
% Derivative constraint rows (1 x N)
drow1 = dphi(x0 - x)' .* sign(x0 - x)';
drow2 = dphi(x1 - x)' .* sign(x1 - x)';
ddrow1 = ddphi(x0 - x)';
ddrow2 = ddphi(x1 - x)';
% Extend system
A_ext = [A; drow1; drow2; ddrow1; ddrow2];
y_ext = [y; 0; 0; 0; 0];
% Solve for RBF weights
lambda = A_ext \ y_ext;
% Evaluate interpolation and derivatives
xx = linspace(0, 1, 200)';
f = zeros(size(xx));
df = zeros(size(xx));
ddf = zeros(size(xx));
for i = 1:N
r = abs(xx - x(i));
s = sign(xx - x(i));
f = f + lambda(i) * phi(r);
df = df + lambda(i) * dphi(r) .* s;
ddf = ddf + lambda(i) * ddphi(r);
end
% Plot
plot(xx, f, 'b', xx, df, 'r--', xx, ddf, 'g-.', x, y, 'ko');
legend('f(x)', 'f''(x)', 'f''''(x)', 'data points');
title('1D RBF Interpolation with Velocity and Acceleration Constraints');
grid on;
I hope this helps.

カテゴリ

Help Center および File ExchangeMathematics and Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by