how to realize look up function in m script

2 visualizzazioni (ultimi 30 giorni)
hello, i have x axle table and y axle table, when i set value within the range of x, how to get the output from y, may be some interpolation and curve smoothing should used. i hope it works in m script.
  8 Commenti
Walter Roberson
Walter Roberson il 5 Lug 2024
xi = interp1(y, x, yi, 'linear', 'extrap')

Accedi per commentare.

Risposta accettata

wenchao zhang
wenchao zhang il 5 Lug 2024
Modificato: Walter Roberson il 5 Lug 2024
use interp1 seems ok,
x = 0:pi/4:2*pi;
v = sin(x);
xq = 0:pi/16:2*pi;
figure
vq2 = interp1(x,v,xq,'spline');
plot(x,v,'o',xq,vq2,':.');
xlim([0 2*pi]);
title('Spline Interpolation');

Più risposte (0)

Categorie

Scopri di più su Smoothing in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by