How to use spline interpolation to find intersection point of two lines.
30 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
PetronasAMG
am 9 Nov. 2021
Kommentiert: PetronasAMG
am 9 Nov. 2021
Hi, Just new to matlab and still trying to understand spline interpolation. Although we can eye ball the interspection point, how do you use spline interpolation to find the exact interspection point? please help!
x = [-10 2];
y1 = -x
y2 = x+6;
plot(x,y1), hold on;
plot(x,y2);
0 Kommentare
Akzeptierte Antwort
H R
am 9 Nov. 2021
How about this?
clc
clear all
x = -10:1:1;
y1=-x;
y2=x+6;
%spline1
s1 = spline(x,y1);
%spline 2
s2=spline(x,y2);
% find zeros
x0 = fzero(@(x) (ppval(s1,x)-ppval(s2,x)), 0)
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Splines finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!