Trying to change the y axis range in fplot
조회 수: 138 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Star Strider
2022년 10월 31일
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]) % ADDED
grid % ADDED
.
추가 답변 (1개)
Chunru
2022년 10월 31일
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]) %<=====================
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!