From a01e63d2a8f8000aa61cce704215d9c55b5f14f4 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 25 Feb 2023 22:22:46 +0100 Subject: [PATCH] p2: add p2.m --- p2/matlab/p2.m | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 p2/matlab/p2.m diff --git a/p2/matlab/p2.m b/p2/matlab/p2.m new file mode 100644 index 0000000..f2e23c0 --- /dev/null +++ b/p2/matlab/p2.m @@ -0,0 +1,27 @@ +cd ~/src/utb/ak9im/ak9im/p2; + +%% load model +load('data/task2.slx'); + +step(1, [2 5 1]) +%% run the simulation in simulink +length(out.u); +length(out.y); + +cd ~/src/utb/ak9im/ak9im/p2/data/; + +m = [out.u, out.y]; +% writematrix(m, 'data/m.csv') + +%% define a system from the transfer function +sys = tf(1, [2 5 1]) +%% get impulse response from CST +ir = impulse(sys) +%% get impulse response from SIT +ircra = cra(out.u, out.y) + +%% save CST impulse response to file +% writematrix(ir, 'data/ir.csv') +%% save SIT impulse response to file +% writematrix(ircra, 'data/ircra.csv') +