plot(t, y, 'linewidth', 2)
y = step( tf([0, K], [T(i), 1]), t);
plot(t,y, 'linewidth', 2, 'DisplayName','T='+string(T(i)))
plot_set(gcf, 't', 'y', 'best')
plot(t, y, 'linewidth', 2)
y = step( tf([0, K(i)], [T, 1]), t);
plot(t,y, 'linewidth', 2, 'DisplayName','K='+string(K(i)))
plot_set(gcf, 't', 'y', 'best')
P = tf([0,omega_n^2], [1, 2*zeta*omega_n, omega_n^2]);
plot(t, y, 'color','k', 'Linewidth', 2);
ymax = 1 + 1 * exp(-(pi*zeta)/sqrt(1-zeta^2))
Tp = pi/omega_n/sqrt(1-zeta^2)
P = tf([0,omega_n^2], [1, 2*zeta(i)*omega_n, omega_n^2]);
plot(t,y, 'linewidth', 2, 'DisplayName','\zeta='+string(zeta(i)))
plot_set(gcf, 't', 'y', 'best')
P = tf([0,omega_n^2], [1, 2*zeta(i)*omega_n, omega_n^2]);
plot(t,y, 'linewidth', 2, 'DisplayName','\zeta='+string(zeta(i)))
plot_set(gcf, 't', 'y', 'best')
for i = 1:1:size(omega_n,2)
P = tf([0,omega_n(i)^2], [1, 2*zeta*omega_n(i), omega_n(i)^2]);
plot(t,y, 'linewidth', 2, 'DisplayName','\omega_n='+string(omega_n(i)))
plot_set(gcf, 't', 'y', 'best')
P1 = tf([1, 3], [1, 3, 2])
P1 =
s + 3
-------------
s^2 + 3 s + 2
連続時間の伝達関数です。
plot(t, y, 'Linewidth', 2);
P2 = tf([0, 1], [1, 2, 2, 1])
P2 =
1
---------------------
s^3 + 2 s^2 + 2 s + 1
連続時間の伝達関数です。
plot(t, y, 'Linewidth', 2);
plot(t, x(:,1), 'linewidth', 2, 'DisplayName', 'x_1');
plot(t, x(:,2), 'linewidth', 2, 'DisplayName','x_2');
plot_set(gcf, 't', 'x', 'best')
plot(t, x(:,1), 'linewidth', 2, 'DisplayName', 'x_1');
plot(t, x(:,2), 'linewidth', 2, 'DisplayName','x_2');
plot_set(gcf, 't', 'x', 'best')
plot(t, x(:,i), 'b-','linewidth', 2, 'DisplayName', 'response');
plot(t, xst(:,i), 'r--','linewidth', 2, 'DisplayName','zero state');
plot(t, xin(:,i), 'k-.','linewidth', 2, 'DisplayName','zero input');
plot_set(gcf, 't', 'x_'+string(i), 'best')
set(gcf,'Position',[100 100 700 300])
xst = lsim(P, Ud, t, 0*X0);
plot(t, x(:,i), 'b-','linewidth', 2, 'DisplayName', 'response');
plot(t, xst(:,i), 'r--','linewidth', 2, 'DisplayName','zero state');
plot(t, xin(:,i), 'k-.','linewidth', 2, 'DisplayName','zero input');
plot_set(gcf, 't', 'x_'+string(i), 'best')
set(gcf,'Position',[100 100 700 300])
P3 = tf([0,1],[1, 0.05, 1]);
pole(P3)
-0.0250 + 0.9997i
-0.0250 - 0.9997i
P4 = tf([0,1],[1, -0.05, 1]);
pole(P4)
0.0250 + 0.9997i
0.0250 - 0.9997i
scatter(real(P1pole), imag(P1pole), 'filled', 'DisplayName', 'P_1')
scatter(real(P2pole), imag(P2pole), 'filled', 'DisplayName', 'P_2')
scatter(real(P3pole), imag(P3pole), 'filled', 'DisplayName', 'P_3')
scatter(real(P4pole), imag(P4pole), 'filled', 'DisplayName', 'P_4')
plot_set(gcf, 'Re', 'Im', 'best')
[Np, Dp] = tfdata(P4, 'v');
roots(Dp)
0.0250 + 0.9997i
0.0250 - 0.9997i
[X, Y] = meshgrid(-w:0.1:w,-w:0.1:w);
if (imag(s(1)) == 0 && imag(s(2)) == 0) %固有値が複素数の場合はプロットできない
plot(t, (v(2,1)/v(1,1))*t)
plot(t, (v(2,2)/v(1,2))*t)
plot_set(gcf, 'x_1', 'x_2')
[X, Y] = meshgrid(-w:0.1:w,-w:0.1:w);
if (imag(s(1)) == 0 && imag(s(2)) == 0) %固有値が複素数の場合はプロットできない
plot(t, (v(2,1)/v(1,1))*t)
plot(t, (v(2,2)/v(1,2))*t)
plot_set(gcf, 'x_1', 'x_2')
[X, Y] = meshgrid(-w:0.1:w,-w:0.1:w);
if (imag(s(1)) == 0 && imag(s(2)) == 0) %固有値が複素数の場合はプロットできない
plot(t, (v(2,1)/v(1,1))*t)
plot(t, (v(2,2)/v(1,2))*t)
plot_set(gcf, 'x_1', 'x_2')
P = tf([ 0, omega_n^2],[1, 2*zeta*omega_n, omega_n^2]);
plot(t, y, 'linewidth', 2, 'DisplayName', 'P_1');
P = tf([ 3, omega_n^2],[1, 2*zeta*omega_n, omega_n^2]);
plot(t, y, 'linewidth', 2, 'DisplayName', 'P_2');
P = tf([ -3, omega_n^2],[1, 2*zeta*omega_n, omega_n^2]);
plot(t, y, 'linewidth', 2, 'DisplayName', 'P_3');
plot_set(gcf, 't', 'y', 'best')
P = tf([0,omega_n^2],[1, 2*zeta*omega_n, omega_n^2]);
u = sin(freq(2*(i-1)+j)*t);
plot(t, u, 'LineWidth', 2);
plot(t, y, 'LineWidth', 2);
plot_set(gcf, 't', 'u, y');
set(gcf,'Position',[100 100 700 600])
P = tf([0, K],[T(i), 1]);
[gain, phase, w] = bode(P, logspace(-2,2));
gainLog = 20*log10(gain(:));
semilogx(w, gainLog, 'LineWidth', 2, 'DisplayName', 'T='+string(T(i)));
semilogx(w, phaseDeg, 'LineWidth', 2, 'DisplayName', 'T='+string(T(i)));
subplot(2,1,1); bodeplot_set(gcf, '\omega [rad/s]', 'Gain [dB]', 'best');
subplot(2,1,2); bodeplot_set(gcf, '\omega [rad/s]', 'Phase [deg]', 'best');
P = tf([0,omega_n^2], [1, 2*zeta(i)*omega_n, omega_n^2]);
[gain, phase, w] = bode(P, logspace(-2,2));
gainLog = 20*log10(gain(:));
semilogx(w, gainLog, 'LineWidth', 2, 'DisplayName', '\zeta='+string(zeta(i)));
semilogx(w, phaseDeg, 'LineWidth', 2, 'DisplayName', '\zeta='+string(zeta(i)));
subplot(2,1,1); bodeplot_set(gcf, '\omega [rad/s]', 'Gain [dB]', 'best');
subplot(2,1,2); bodeplot_set(gcf, '\omega [rad/s]', 'Phase [deg]', 'best');
for i=1:1:size(omega_n,2)
P = tf([0,omega_n(i)^2], [1, 2*zeta*omega_n(i), omega_n(i)^2]);
[gain, phase, w] = bode(P, logspace(-2,2));
gainLog = 20*log10(gain(:));
semilogx(w, gainLog, 'LineWidth', 2, 'DisplayName', '\omega_n='+string(omega_n(i)));
semilogx(w, phaseDeg, 'LineWidth', 2, 'DisplayName', '\omega_n='+string(omega_n(i)));
subplot(2,1,1); bodeplot_set(gcf, '\omega [rad/s]', 'Gain [dB]', 'best');
subplot(2,1,2); bodeplot_set(gcf, '\omega [rad/s]', 'Phase [deg]', 'best');
P1 = tf([1, 3], [1, 3, 2])
P1 =
s + 3
-------------
s^2 + 3 s + 2
連続時間の伝達関数です。
[gain, phase, w] = bode(P1, logspace(-2,2));
gainLog = 20*log10(gain(:));
semilogx(w, gainLog, 'LineWidth', 2, 'DisplayName', '\omega_n='+string(omega_n(i)));
bodeplot_set(gcf, '\omega [rad/s]', 'Gain [dB]');
semilogx(w, phaseDeg, 'LineWidth', 2, 'DisplayName', '\omega_n='+string(omega_n(i)));
bodeplot_set(gcf, '\omega [rad/s]', 'Phase [deg]');
P2 = tf([0, 1], [1, 2, 2, 1])
P2 =
1
---------------------
s^3 + 2 s^2 + 2 s + 1
連続時間の伝達関数です。
[gain, phase, w] = bode(P1, logspace(-2,2));
gainLog = 20*log10(gain(:));
semilogx(w, gainLog, 'LineWidth', 2, 'DisplayName', '\omega_n='+string(omega_n(i)));
bodeplot_set(gcf, '\omega [rad/s]', 'Gain [dB]');
semilogx(w, phaseDeg, 'LineWidth', 2, 'DisplayName', '\omega_n='+string(omega_n(i)));
bodeplot_set(gcf, '\omega [rad/s]', 'Phase [deg]');
P = tf([0,1],[1, 2, 3, 4, 5])
P =
1
-----------------------------
s^4 + 2 s^3 + 3 s^2 + 4 s + 5
連続時間の伝達関数です。
pole(P)
-1.2878 + 0.8579i
-1.2878 - 0.8579i
0.2878 + 1.4161i
0.2878 - 1.4161i
[~, Dp] = tfdata(P, 'v');
roots(Dp)
-1.2878 + 0.8579i
-1.2878 - 0.8579i
0.2878 + 1.4161i
0.2878 - 1.4161i