In following plots, how can we measure intersect points?
3 views (last 30 days)
Show older comments
clear all
clc
for y=0.1:0.1:0.3;
G=[];
B=[];
for a=1:1:100
z=0.3;
x=y+sind(a);
G=[G x];
b=z+0.4;
B=[B b];
end
B;
G;
a=1:1:100;
plot(a,G,'-')
hold on
plot(a,B,'-')
end
0 Comments
Accepted Answer
Kevin Holly
on 16 Feb 2023
for y=0.1:0.1:0.3
G=[];
B=[];
for a=1:1:100
z=0.3;
x=y+sind(a);
G=[G x];
b=z+0.4;
B=[B b];
end
B;
G;
a=1:1:100;
plot(a,G,'-')
hold on
plot(a,B,'-')
%spline1
s1 = spline(a,G);
%spline 2
s2=spline(a,B);
% find zeros
a0 = fzero(@(a) (ppval(s1,a)-ppval(s2,a)), 0) %Intersection point using spline interpolation
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!