mu = 0;
sigma = pi/2;
x0 = 0;
gamma = 1;
x = -10:0.01:10;
y1 = normpdf(x, mu, sigma);
y2 = (1/pi)*gamma./(gamma^2 + (x-x0).^2);
plot(x, y1, 'b-', x, y2, 'r-');
c1=[y1;x]; %requested format to use the InterX
c2=[y2;x];
p=InterX(c1,c2); %first row is y values of intersections, second row x values
[~,noI]=size(p); %noI is the number of intersections
1条答案
按热度按时间2mbi3lxu1#
使用文件交换中的InterX函数:
您可以在此处找到InterX函数:https://ch.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?s_tid=ta_fx_results