x = linspace(-pi,pi,1000);
y1 = sin(x);
y2 = cos(x);
plot(x,y1,x,y2);hold on;
id = find(abs(y1-y2)<0.005); % 找到交点
plot(x(id),y1(id),'r*');
x = linspace(-pi,pi,1000);
y0= sin(x);
y = cos(x);
plot(x,y1,x,y2);hold on;
id = find(abs(y1-y2)<0.005); % 寻找出交点
plot(x(id),y1(id),'r*');
恩