# Intersection between 2 symbolic functions

1 view (last 30 days)
Ana Gabriela Guedes on 14 Dec 2021
Hey!
I have 3 symbolic gaussian function and need to find the intersection between the two Gaussian components on the most right (which I'm guessing it might be the ones with higher mean value??). But I don't really know how to do this since I am not used to work with symbolic functions.
The code that got me here is the following one, would really appreciate if someone could help.
clear,clc
% a) Gaussian mixture distribution
X = reshape(I, [prod(size(I)), 1]);
gmModel = fitgmdist(X, 3, 'Replicates', 10); % Gaussian mixture distribution with k = 3, repeating 10 times
means = gmModel.mu'; % Means of the gaussian distributions
sigmas = [gmModel.Sigma(1),gmModel.Sigma(2),gmModel.Sigma(3)]; % Covariances of the gaussian distributions
compProp = gmModel.ComponentProportion; % Hights of the gaussian distributions
% Gaussian function corresponding to all components of the fitted model
gaussian1 = makedist('Normal','mu',means(1),'sigma',sigmas(1));
gaussian2 = makedist('Normal','mu',means(2),'sigma',sigmas(2));
gaussian3 = makedist('Normal','mu',means(3),'sigma',sigmas(3));
syms x m s p
f = symfun(p/(s.*sqrt(2*pi)).*(exp(-((x-m).^2)./(2.*(s.^2)))), [x, m, s, p]);
for k = 1:3
ff(k) = f(x, means(k), sqrt(sigmas(k)), compProp(k));
end