My subplot images are cut off, why?
Show older comments
My images gets cut off when the function is on steady state, I think the problem comes from step command, because I'm getting [y, t] = step(sys)
informations and I don't know why this cut off automatically when a plot inside a subplot!
clc
clear all
syms s;
format short
%-------------------------------------------------------------------------%
% I)
wn1 = 1; k1 = [0 0 5]; zeta1 = [1.5, 0.7, 0.3];
G1 = tf(k1, [1 2*zeta1(1)*wn1 wn1^2]);
G2 = tf(k1, [1 2*zeta1(2)*wn1 wn1^2]);
G3 = tf(k1, [1 2*zeta1(3)*wn1 wn1^2]);
%-------------------------------------------------------------------------%
% II)
wn2 = 10; k2 = [0 0 5]; zeta2 = [1.5, 0.7, 0.3];
G4 = tf(k2, [1 2*zeta2(1)*wn2 wn2^2]);
G5 = tf(k2, [1 2*zeta2(2)*wn2 wn2^2]);
G6 = tf(k2, [1 2*zeta2(3)*wn2 wn2^2]);
%-------------------------------------------------------------------------%
lw = 3; %linewidth
ax1 = subplot(2,1,1); %i
hold on
[a,b] = step(G1);
plot(b, squeeze(a), 'LineWidth', lw, 'Color', 'r');
[a1,b1] = step(G2);
plot(b1, squeeze(a1), 'LineWidth', lw, 'Color', 'g');
[a2,b2] = step(G3);
plot(b2, squeeze(a2), 'LineWidth', lw, 'Color', 'b');
hold off
grid on
ax2 = subplot(2,1,2); %ii
hold on
[a3,b3] = step(G4);
plot(b3, squeeze(a3), 'LineWidth', lw, 'Color', 'r');
[a4,b4] = step(G5);
plot(b4, squeeze(a4), 'LineWidth', lw, 'Color', 'g');
[a5,b5] = step(G6);
plot(b5, squeeze(a5), 'LineWidth', lw, 'Color', 'b');
hold off
grid on

Accepted Answer
More Answers (0)
Categories
Find more on Solver Outputs and Iterative Display 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!