Course materials · Control Engineering I

Control Engineering I · Week 01 · Getting Started with Control Systems and MATLAB

English translation

Edit the code and response fields in your own copy. Name: ⟦enter here⟧ / Student ID: ⟦enter here⟧

How to run

In Live Editor, click inside the code and run the current section with Run Section (Windows/Linux Ctrl+Enter, Mac ⌘+Enter). Run executes the entire document. Edit the explanations and response fields directly.
Initially run from the top, and rerun any section whose values you change. If an undefined-variable error occurs, run the preceding sections first. Outputs appear below or to the right of the code.
Environment: MATLAB Online. This exercise uses basic MATLAB functionality.

1. Check the environment

Check the MATLAB version and basic calculations.
Prediction before running: ⟦enter here⟧
disp(version);
a=1:5;
disp(a.^2);
Do it yourself:
  1. Change to a=0:0.5:3, then display numel(a) and a.^2. Record the number of elements and the square of each element.
% ✍ Your code: add your own code below.
Changed condition: ⟦enter here⟧
Observed result: ⟦enter here⟧
Differences from the prediction and their causes: ⟦enter here⟧

2. First plot

Click inside the code and select Run Section.
Prediction before running: ⟦enter here⟧
t=0:0.05:2*pi;
figure;plot(t,sin(t));grid on;xlabel('Time (s)');ylabel('Amplitude');title('Sine');
Do it yourself:
  1. Calculate cos(t) using the same t as the “2. First plot” code in the practice Live Script, and plot it with sin(t) in the same figure.
  2. Use the legend to distinguish the sine and cosine curves. Retain a figure showing both curves.
% ✍ Your code: add your own code below.
Changed condition: ⟦enter here⟧
Observed result: ⟦enter here⟧
Differences from the prediction and their causes: ⟦enter here⟧

Practice through repetition and check before submission

Summarize the three conditions compared in the preceding hands-on activities below. You do not need to repeat experiments already completed. Predictions may state increasing or decreasing trends instead of exact values.
Repetition 1 — Condition: ⟦enter here⟧ / Prediction: ⟦enter here⟧ / Actual result: ⟦enter here⟧
Trial 2 — Condition: ⟦enter here⟧ / Prediction: ⟦enter here⟧ / Observation: ⟦enter here⟧
Trial 3 — Condition: ⟦enter here⟧ / Prediction: ⟦enter here⟧ / Observation: ⟦enter here⟧
Optional:
Example: Omitting the dot operator in an array operation
  1. In a=1:5, run only the line with a.^2 changed to a^2 separately, and retain the error message.
  2. State whether you intend matrix exponentiation or element-wise squaring. Restore that line to a.^2 and record all five results.
Include code, actual outputs and plots, and your own interpretation. Submit through KLAS; check the semester schedule and latest announcements for the deadline.
Filename: Name_StudentID_Week1.mlx.