# plotting quadratic equation and curve fittting

184 views (last 30 days)
Avinash Tallapaneni on 13 Dec 2016
Commented: Star Strider on 14 Dec 2016
im kinda of struck how to plot quadratic function for different x and y values.the equation is (x^25)+(y^3)-(6*x^24*y) for different values of x =[-10,10] and y=[-10,10] and do a polyfit for the obtained point

Star Strider on 13 Dec 2016
The plot is straightforward:
fcn = @(x,y) (x.^25)+(y.^3)-(6*x.^24.*y);
[X,Y] = meshgrid(-10:0.5:10);
figure(1)
meshc(X, Y, fcn(X,Y))
grid on
xlabel('X')
ylabel('Y')
I do not know the reason you would want to fit this with polyfit. You already have the equation for the surface.

Star Strider on 13 Dec 2016
The xy plane the function uses are defined by the ‘X’ and ‘Y’ outputs of meshgrid.
Avinash Tallapaneni on 13 Dec 2016
my friend i am new to matlab maybe i am conveying you wrong , i know that the surface is projected on plane so we get those curves.i need only the highlighted part not the surface maybe a transparent surface but a visible color curves ,is that possible? thankyou
Star Strider on 14 Dec 2016
The plot you want is the contour function to only plot the contours.
The plot you show was produced by the meshc function. It draws the surface and the contours.