how to realize look up function in m script

1 Ansicht (letzte 30 Tage)
wenchao zhang
wenchao zhang am 5 Jul. 2024
Kommentiert: wenchao zhang am 6 Jul. 2024
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 Kommentare
Walter Roberson
Walter Roberson am 5 Jul. 2024
xi = interp1(y, x, yi, 'linear', 'extrap')
wenchao zhang
wenchao zhang am 6 Jul. 2024
yes,you are right.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

wenchao zhang
wenchao zhang am 5 Jul. 2024
Bearbeitet: Walter Roberson am 5 Jul. 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');

Weitere Antworten (0)

Kategorien

Mehr zu Smoothing finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by