필터 지우기
필터 지우기

In following plots, how can we measure intersect points?

조회 수: 1 (최근 30일)
MOHD UWAIS
MOHD UWAIS 2023년 2월 16일
답변: Kevin Holly 2023년 2월 16일
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

채택된 답변

Kevin Holly
Kevin Holly 2023년 2월 16일
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
a0 = 36.8699
a0 = 30.0000
a0 = 23.5782

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Splines에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by