Trying to change the y axis range in fplot
154 ビュー (過去 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!