MATLAB: How to find x-values when y-function equals a set value

x values when the function equals=n

Hi, there!
New to matlab.. I have a dilema trying to find the x-values for a function =0.7(see figure). And I should be able to find both values of x when the bell-curve changes.
Big help, please! I've tried fzero, and other functions and mostly does't work or it will just give me one single value of x. there should always be 2.
Thank you in advance!
x=[0.46 0.7]
f=(a1*exp(-((x-b1)/c1).^2))=0.7
The a1, b1 and c1 values are known.

Best Answer

Try this:
x = linspace(0.54, 0.61); % Create Data

y = exp(-(x-0.58).^2*1E+4); % Create Data
idx = find(diff(sign(y-0.7)));
for k = 1:numel(idx)
idxrng = [-1 1]+idx(k);
x7(k) = interp1(y(idxrng), x(idxrng), 0.7); % Interpolate To Find Intersection ‘x’-Value
end
figure
plot(x, y)
hold on
plot(xlim, [1 1]*0.7, ':k', 'LineWidth',1) % Reference Line
plot(x7, [1 1]*0.7, 'pg','MarkerFaceColor','g','MarkerSize',10) % Intersections
plot([1 1]*x7(1), [min(ylim) 0.7], ':k')
plot([1 1]*x7(2), [min(ylim) 0.7], ':k')
hold off
legend('Data','Reference','Intersections', 'Location','NW')
Use your own function for ‘y’. I would have used it, however the parameters are nowhere to be found.
EDIT — (18 Oct 2020 at 19:37)
Added plot image —
.