Create a diagram with 3 polynomials
1 次查看(过去 30 天)
显示 更早的评论
I have defined 3 polynomials
P1 = [ 1 -2 -15]
P2 = [1 -7 12]
P3 = [1 1 -14 -24]
I want to generate a graph that will present the shape of all polynomials in range from -100 to 100 with specific description(the logarithmic axes)
How can I do it?
0 个评论
采纳的回答
Star Strider
2022-8-30
I am not certain wht you want with ‘logarithmic axes’ so this creates both as logarithmic —
P1 = [ 1 -2 -15];
P2 = [1 -7 12];
P3 = [1 1 -14 -24];
x = linspace(-100, 100, 250);
V1 = polyval(P1,x);
V2 = polyval(P2,x);
V3 = polyval(P3,x);
figure
plot(x, [V1;V2;V3])
Ax = gca;
Ax.XScale = 'log'; % Logarithmic X-Axis
Ax.YScale = 'log'; % Logarithmic Y-Axis
grid
It may be best to only have the x-axis be logarithmic, and if so, consider using logspace instead of linspace.
.
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!