Trying to change the y axis range in fplot
Show older comments
This is the code
clear all
clc
close all
syms s a b c d e f
n10 = a + (b*s) + c*(s^2) + d*(s^3) + e*(s^4) + f*(s^5)
n10_d1 = diff(n10,s)
n10_d2 = diff(n10_d1,s)
A = subs(n10,s,-1)
B = subs(n10,s,1)
C = subs(n10_d1,s,-1)
D = subs(n10_d1,s,1)
E = subs(n10_d2,s,-1)
F = subs(n10_d2,s,1)
eqn1 = A == 0;
eqn2 = B == 0;
eqn3 = C == 1;
eqn4 = D == 0;
eqn5 = E == 0;
eqn6 = F == 0;
[G,H] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6], [a, b, c, d, e, f])
X = linsolve(G,H)
x = [1;s;s^2;s^3;s^4;s^5]
N3 = transpose(X)*x
hold on
fplot(N3,[-1 1])
It plots automatically between y = 0 and y = 0.4
I want to plot it between y= -1 and y = +1
The purpoe is comparison with other existing graphs that are between -1<=y<=1
Running it on MATLAB online
Please help
Accepted Answer
More Answers (1)
syms s a b c d e f
n10 = a + (b*s) + c*(s^2) + d*(s^3) + e*(s^4) + f*(s^5)
n10_d1 = diff(n10,s)
n10_d2 = diff(n10_d1,s)
A = subs(n10,s,-1)
B = subs(n10,s,1)
C = subs(n10_d1,s,-1)
D = subs(n10_d1,s,1)
E = subs(n10_d2,s,-1)
F = subs(n10_d2,s,1)
eqn1 = A == 0;
eqn2 = B == 0;
eqn3 = C == 1;
eqn4 = D == 0;
eqn5 = E == 0;
eqn6 = F == 0;
[G,H] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6], [a, b, c, d, e, f])
X = linsolve(G,H)
x = [1;s;s^2;s^3;s^4;s^5]
N3 = transpose(X)*x
hold on
fplot(N3,[-1 1])
ylim([-1 1]) %<=====================
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




