MATLAB represents polynomials by placing the coefficients of the polynomial in a vector, always assuming that the polynomial is arranged in descending powers. For example, the vector p = [2, −5, 3, −4] would be used to represent the polynomial p(x) = 2x3 − 5x2 + 3x − 4. The MATLAB function POLYFIT(X, Y, N) will fit a polynomial of degree N to the data stored in X and Y. Take the logarithm base ten of both sides of the power function y = 10x3 to get log10 y = 1 + 3 log10 x. As we saw in Exercise, the graph of log10 y versus log10 x is a line with slope 3 and intercept 1, plotted with the commands x = linspace (0.1,2); y = 10*x.^3; plot(log10(x) , log10(y)), grid on. One can read the slope and intercept from the plot, or you can allow MATLAB to calculate them with p = polyfit(log10(x), log10(y) ,1), which responds with the polynomial p = [3 1]. The coefficients of this polynomial represent the slope and intercept, respectively, of log10 y = 3 log10 x + 1. Exponentiating base ten, we recapture the power function y = 10x3. In Exercise, follow this procedure to perform a loglog plot (base ten) of the given power function, then use the polyfitcommand to find the slope and intercept of the resulting line. Exponentiate the resulting equation to obtain the original power function.
y = 100x3
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.