In Matlab What does the command polyfit x y 4 do creates a b

In Matlab:

What does the command polyfit (x, y, 4) do? creates a best fit, 4th order polynomial from the corresponding points of matrix \'x\' and matrix \'y\' outputs the first 4 points of polynomial y in terms of x fits polynomial \'x\' to polynomial \'y\' to the 4th degree uses the first 4 corresponding points of matrix \'x\' and matrix \'y\' to create a polynomial To plot a multivariable function z = f(x, y), what command should you use: plot3d plot3 surface surf

Solution

Please follow the data and description :

1) polyfit() :

In the stream of matlab the command or the code polyfit(x,y,n) returns the coefficients for a particular polynomial namely p(x) of degree n that is a best fit in a least-squares sense for the data in y. The coefficients in p are in descending powers, and the length of p is n+1.

So the answer is OPTION A (Creates a best fit, 4th order polynomial from the corresponding points of a matrix \'x\' and a matrix \'y\').

2) Multi Dimensional Plots :

In the stream of matlab the three dimensional plots are typically used to display a surface that are defined by a function in two variables, z = f(x,y).

So as to evaluate z, first we need to create a set of (x,y) points over the domain of the function using meshgrid.

[X,Y] = meshgrid(-2:.2:2);
Z = X .* exp(-X.^2 - Y.^2);

Then, create a surface plot.

surf(X,Y,Z).


So the answer is OPTION D (surf).

Hope this is helpful.

In Matlab: What does the command polyfit (x, y, 4) do? creates a best fit, 4th order polynomial from the corresponding points of matrix \'x\' and matrix \'y\' o

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site