Created
April 14, 2021 17:14
-
-
Save MichaelTr7/f76dab44c02f8b9ba2254805ab0b1def to your computer and use it in GitHub Desktop.
A MATLAB script that defines a function in terms of the basic unit step.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% FUNDAMENTAL UNIT STEP FUNCTION %% | |
%Subplot dimensions% | |
Rows = 3; | |
Columns = 1; | |
u = @(n) (n >= 0); | |
subplot(Rows,Columns,1); fplot(u); | |
title("Unit Step Function"); | |
xlim([-5 5]); | |
ylim([-0.1 1.1]); | |
%% FUNCTION CHARACTERIZED IN TERMS OF UNIT STEPS %% | |
Function = @(n) u(n) - u(n-4); | |
subplot(Rows,Columns,2); fplot(Function); | |
title("Function Characterized in Terms of Unit Steps"); | |
xlim([-5 5]); | |
ylim([-0.1 1.1]); | |
%% DISCRETE PLOT OF ABOVE FUNCTION %% | |
N = (0:5); | |
subplot(Rows,Columns,3); stem(Function(N)); | |
title("Discrete Plot of Above Function"); | |
xlim([-5 5]); | |
ylim([-0.1 1.1]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output Result