
function MM_MB_Plot(M,Mc,x1,x2,m,zer1,zer2,gau_b,poch,poch2)
M=M(M>=Mc);

% -----  plotting magnitude density and its derivatives ------
xp=linspace(x1,x2,m)';
%st=range([x1 x2])/(m-1);xp=x1:st:x2;
figure('rend','painters','pos',[800 100 600 900]);hold on
                         subplot(3,1,1);
plot(xp,gau_b,'LineWidth',2);hold on;
for i=1:length(zer1)
    Le1=plot([zer1(i) zer1(i)],[0 10],'k--','LineWidth',1);
end
for i=1:length(zer2)
    Le2=plot([zer2(i) zer2(i)],[0 10],'r--','LineWidth',1);
end
xlim([min(M)-0.1 max(M)+0.1]);ylim([0 max(gau_b)+0.01])
title(['Data  density  for  h_c_r_i_t  ';'  (critical smoothing factor)  '],'FontSize',14);%axis square
legend([Le1,Le2],{'extremum','Inflection Point(s)'});ylabel('PDF','FontSize',14)
                         subplot(3,1,2);
plot(xp,poch,'LineWidth',2);ylabel('1^s^t derivative','FontSize',14);hold on;%axis square;
plot([xp(1) xp(length(xp))],[0 0],'--','LineWidth',1)
for i=1:length(zer1)
    plot([zer1(i) zer1(i)],[min(poch)-0.01 max(poch)+0.01],'k--','LineWidth',1)
end
for i=1:length(zer2)
    plot([zer2(i) zer2(i)],[min(poch)-0.01 max(poch)+0.01],'r--','LineWidth',1)
end
xlim([min(M)-0.1 max(M)+0.1]);ylim([min(poch)-0.01 max(poch)+0.01])
                           subplot(3,1,3);
plot(xp,poch2,'LineWidth',2);ylabel('2^n^d derivative','FontSize',14);%axis square
hold on; plot([xp(1) xp(length(xp))],[0 0],'--','LineWidth',1)
for i=1:length(zer1)
   plot([zer1(i) zer1(i)],[min(poch2)-0.01 max(poch2)+0.01],'k--','LineWidth',1)
end
for i=1:length(zer2)
   plot([zer2(i) zer2(i)],[min(poch2)-0.01 max(poch2)+0.01],'r--','LineWidth',1)
end
xlim([min(M)-0.1 max(M)+0.1]);ylim([min(poch2)-0.01 max(poch2)+0.01])
xlabel('Data','FontSize',14);

cd Outputs_MM_MB\;saveas(gcf,'Mulitimodality_output.jpg');cd ../

end

