- #1
saeede-
- 9
- 0
hey everyone . I want to plot a Grade 4 equation in MATLAB. but don't know how to do. Can anyone guide me?
equation : f = 1.47*(x^4)-10^7*(x)+58.92*(10^6)
equation : f = 1.47*(x^4)-10^7*(x)+58.92*(10^6)
x = 0:0.01:10;
f = 1.47*(x.^4)-10^7*(x)+58.92*(10^6)
Your post confused me -- I thought this might be an equation given to someone in the fourth grade. In English we call such equations fourth degree, not Grade 4.saeede- said:hey everyone . I want to plot a Grade 4 equation in MATLAB. but don't know how to do. Can anyone guide me?
equation : f = 1.47*(x^4)-10^7*(x)+58.92*(10^6)
I suspect, without much evidence, that the OP merely wants to graph the equation, where x is a real number.Orodruin said:If your x is a row/column matrix you will need to add a . before multiplicative operations to make them element-by-element.
Yes, and the typical way to do that in MATLAB is to first create a vector x containing the x values, then using a function as described above to get the corresponding y-values. Then using the MATLAB plot function, which takes the vectors of x and y values as input. This is why you need the dot in the operator in the second step.Mark44 said:I suspect, without much evidence, that the OP merely wants to graph the equation, where x is a real number.
x = [0:100]
y = x .* x
plot(x,y)
yes I'm not an English person . so it's normal having such mistakes.Mark44 said:Your post confused me -- I thought this might be an equation given to someone in the fourth grade. In English we call such equations fourth degree, not Grade 4.
To input a 4th degree polynomial into MATLAB, you can use the "polyfit" function. This function takes in two arguments: the x-values and the y-values of the polynomial. For example, if your polynomial is y = 3x^4 + 5x^3 + 2x^2 + 7x + 1, you would input the x-values and y-values as separate vectors, and then use the polyfit function to obtain the coefficients of your polynomial.
To plot a 4th degree polynomial in MATLAB, you can use the "plot" function. First, you need to create a vector of x-values over the range you want to plot. Then, you can use the "polyval" function to evaluate your polynomial at each of these x-values. Finally, use the "plot" function to plot the x-values against the evaluated y-values.
Yes, you can customize the appearance of your plot by using additional arguments in the "plot" function. For example, you can change the color, line style, and marker style of your plot. You can also add a title, labels for the x and y axes, and a legend to your plot.
To find the roots of a 4th degree polynomial in MATLAB, you can use the "roots" function. This function takes in the coefficients of your polynomial as an argument and returns the complex roots of the polynomial. You can also use the "fzero" function to find a specific root by providing an initial guess.
Yes, you can use MATLAB to solve equations involving 4th degree polynomials by using the "solve" function. This function takes in two arguments: the equation to solve and the variable to solve for. It will return the solutions to the equation as a vector. You can also use the "fzero" function to solve for a specific root of the polynomial.