From aba7e87114beb624e3738e64aa2367557de3a0ca Mon Sep 17 00:00:00 2001 From: Matte23 Date: Wed, 27 Mar 2024 10:39:23 +0100 Subject: [PATCH] feat: Add partial second lab --- Lab02.m | 25 +++++++++++++++++++++++++ generatePlots.m | 11 +++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Lab02.m create mode 100644 generatePlots.m diff --git a/Lab02.m b/Lab02.m new file mode 100644 index 0000000..dce9ff2 --- /dev/null +++ b/Lab02.m @@ -0,0 +1,25 @@ +s = tf('s'); + +%% 1 +H = 1/(s*(s+2)*(s+4)); +generatePlots(H) + +%% 2 +H = -0.1*(1-2*s)/(s*(s+0.2)*(s+1)); +generatePlots(H) + +%% 3 +H = 1/(s*s*(s+3)); +generatePlots(H) + +%% 4 +H = 2*(1+0.5*s)/((1+s)*(1-s)^2); +generatePlots(H) + +%% 5 +H = (s*s+1)/((s-2)*(s+2)*(s+4)); +generatePlots(H) + +%% 7 +H = (s-2)/((2+s)*(s*s+1)); +generatePlots(H) \ No newline at end of file diff --git a/generatePlots.m b/generatePlots.m new file mode 100644 index 0000000..f4986a8 --- /dev/null +++ b/generatePlots.m @@ -0,0 +1,11 @@ +function generatePlots(H) + subplot(1,2,1) + plotoptions = bodeoptions; + plotoptions.Grid = 'on'; + %plotoptions.FreqScale = 'linear'; + bodeplot(H,plotoptions) + subplot(1,2,2) + [num, den] = tfdata(H, "v"); + nyquist(num,den) + grid on +end \ No newline at end of file