MATLAB: How to code a basic fitting quadratic in this

basic fittingcurve fittingfittingMATLABpolyfitpolyval

Hi everyone,
I am using two scatter plots. How can I code the quadratic fitting in that? I tried more than 7 ways on the internet and it's not working. It does not work with polyfit n=5. It just turns into a mesy multiple lines!
Thanks
s
ScatterPlotPreCOVID = scatter(x,y,'o')
hold on
ScatterPlotPostCOVID = scatter(x1,y1,'^')
hold off
Now, I do not insist coding it into it but I cannot have both quadratics simultanously for two datasets from the tools too.

Best Answer

P = polyfit(x, y, 2);
The approximation function is then P(1)*x^2 + P(2)*x + P(3)