Borrar filtros
Borrar filtros

In following plots, how can we measure intersect points?

1 visualización (últimos 30 días)
MOHD UWAIS
MOHD UWAIS el 16 de Feb. de 2023
Respondida: Kevin Holly el 16 de Feb. de 2023
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

Respuesta aceptada

Kevin Holly
Kevin Holly el 16 de Feb. de 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
a0 = 36.8699
a0 = 30.0000
a0 = 23.5782

Más respuestas (0)

Categorías

Más información sobre Splines en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by