MATLAB: Plot multiple implicit functions

fimplicitfunctionplot

I plotted a simple single implicit function using fimplicit code below. I'm wondering how to plot multiple implicit functions. For example, I want to use fimplicit to plot multiple f(x,y) with intervals of S defined in the function, i.e. S=1:0.1:2
Maybe fimplicit is not a good option. Could anyone advise other plot commands how to plot f(x,y) with multiple S intervals?
%% Main
fun = @f1;
fimplicit(fun, [-2 2 -2 2],'r');
%% Function
function z = f1(x,y)
a=1;h=1;p=1;tau=0;m=10;S=1;
K1 = (x+h*y)/2;
K2 = (((x-h*y)/2).^2+(p*tau).^2).^(1/2);
c = 2-a;
z = a*(abs(K1+K2).^m) + a*(abs(K1-K2).^m) + c*((2*K2).^m) - 2*(S^m);
end

Best Answer

Try this:
%% Main
Sv = 1:0.1:2; % Define The Range Of ‘S’ As A Vector
figure
hold all
for k = 1:numel(Sv)
fimplicit(@(x,y)f1(x,y,Sv(k)), [-2 2 -2 2]);
end
hold off
grid
%% Function
function z = f1(x,y,S)
a=1;h=1;p=1;tau=0;m=10;
K1 = (x+h*y)/2;
K2 = (((x-h*y)/2).^2+(p*tau).^2).^(1/2);
c = 2-a;
z = a*(abs(K1+K2).^m) + a*(abs(K1-K2).^m) + c*((2*K2).^m) - 2*(S^m);
end
Note that it is necessary to remove the assigned value of ‘S’ inside ‘f1’, so the passed parameter is the value the function uses.