Question: % % Lab 2 _ Ex 1 . m % This script simulates an RLC simulink model. % Alex Gregg, 2 0 1 9 .

%% Lab2_Ex1.m
% This script simulates an RLC simulink model.
% Alex Gregg, 2019.
% A few important rules:
%- DO NOT MODIFY THIS SCRIPT OR THE ACCOMPANYING FUNCTIONS.
% For this problem, You are ONLY being assessed on your simulink model.
%
%- You are being assessed on your ability to create a model which
% is compatible with pre-existing simulation code. If your model
% cannot generate the correct output (plots) with this code, then you
% need to modify your model, not the code!
%
%- DO NOT HARD-CODE parameter values. This script generates some
% parameters (e.g. R, L, C, Z0 etc). You must use these parameters in your
% gain blocks, integrator blocks, etc). We will check whether you
% have hard-coded values in the integrator blocks (bad) or correctly
% used the outputs of the setupsim_ex1() function.
%
%- A sample output has been provided for you to check your results.
%% Housekeeping
% Close all windows, clear the workspace, clear the command line
close all;
clearvars;
clc;
%% Setup the simulation
% Call a function which defines the model and simulation parameters and
% returns these to the workspace. These parameters will then be available
% to simulink to use. This function takes no inputs.
[R,L,C,u1,Z0,tfinal]= setupsim_ex1();
%% Simulate the model rot_msd.slx
% Use the sim function to simulate the model "rlc.slx". Store the
% simulation outputs (the "to workspace" blocks) in a structure called
% "results".
results = sim('rlc.slx');
%% Plot the results
% Call a function to plot the simulation results. This function takes the
% results structure from the sim function as an input and uses it to plot
% the results in a nice way. This function has no outputs (it just produces
% a plot).
plotresults_ex1(results);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!