Plot 4th degree polynomial

  • Thread starter saeede-
  • Start date
  • #1
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)
 

Answers and Replies

  • #2
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
17,247
7,068
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.
 
  • Like
  • Love
Likes jedishrfu and saeede-
  • #3
12,951
6,798
The dot operator is something often missed by newbies to matlab.
 
  • #4
35,138
6,887
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.
 
  • #5
35,138
6,887
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.
 
  • #6
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
17,247
7,068
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.
 
  • #8
9
0
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.
 

Related Threads on Plot 4th degree polynomial

  • Last Post
Replies
4
Views
2K
Replies
5
Views
1K
Replies
0
Views
2K
  • Last Post
Replies
1
Views
726
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
6
Views
1K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
2
Views
766
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
1
Views
3K
Top