Generate diagram in linear scale

2 Ansichten (letzte 30 Tage)
Berkay
Berkay am 30 Aug. 2022
Beantwortet: Abderrahim. B am 30 Aug. 2022
I defined a polynomia;
P = [1 10 -13 -118 120]
I want to generate a diagram in linear scale of that polynomial in range from -100 to 100
How can I do it?

Akzeptierte Antwort

Abderrahim. B
Abderrahim. B am 30 Aug. 2022
Hi!
See these 2 methods:
P = [1 10 -13 -118 120] ;
Method 1:
figure
plot(-100:100, polyval(P, -100:100))
Method 2:
myPoly = @(p)P(1)*p.^4 + P(2)*p.^3 -P(3)*p.^2 -P(4)*p.^1 + P(5) ;
plot(-100:100, myPoly(-100:100))

Weitere Antworten (1)

Alan Stevens
Alan Stevens am 30 Aug. 2022
See
help polyval

Kategorien

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by