# Plot 4th degree polynomial

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)

Orodruin
Staff Emeritus
Homework Helper
Gold Member
If your x is a row/column matrix you will need to add a . before multiplicative operations to make them element-by-element. In other words, if you have something like
Code:
x = 0:0.01:10;
then you will need to do
Code:
f = 1.47*(x.^4)-10^7*(x)+58.92*(10^6)
because Matlab does not understand what a row/column matrix to the power of 4 means.

jedishrfu and saeede-
jedishrfu
Mentor
The dot operator is something often missed by newbies to matlab.

Mark44
Mentor
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)
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.

Mark44
Mentor
If your x is a row/column matrix you will need to add a . before multiplicative operations to make them element-by-element.
I suspect, without much evidence, that the OP merely wants to graph the equation, where x is a real number.

Orodruin
Staff Emeritus
Homework Helper
Gold Member
I suspect, without much evidence, that the OP merely wants to graph the equation, where x is a real number.
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.

jedishrfu
jedishrfu
Mentor
Plot example:
x = [0:100]
y = x .* x
plot(x,y)

Also there is a nice MATLAB clone called Freemat which supports the core functionality of MATLAB.

http://freemat.sourceforge.net/

PhDeezNutz, berkeman and Orodruin
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.
yes I'm not an English person . so it's normal having such mistakes.