What is unit step function?:
How to create it using MATLAB ?:
Note: The more samples we have the graph is more accurate.What format to save ?:
You can save in .m format with any file name. However it is preferred to save the file as Function.m where Function does a specific job which is a conventional style. For this example I had saved as step_fn.mHow to execute command in Matlab ?:
For this you need to go to command window and give a value for a time. For this example I had given value for time from [-2,2]. In command window you need to type "t=startavlue:dt:endtime" . Also, by "t=starttime:endtime" . And to plot it use command plot(t,function) where function is the one you just created. You may follow the picture down below.What is ramp function?:
How to create it using MATLAB ?:
pic
What can we do more with these function function ?
You can use these two function and create a new graph. Figure below illustrates it.Well you can create variety of graph just using this function. For example see the figure below
MATLAB Code ?:
Where t+1 and t-1 shifts the graphs towards left and right respectively whereas multiplication symbol scales the graph by that unit.
More Examples!!!
MATLAB Code!!!
Useful Tips!!!
% : To comment on a codeclc % Clears command window
clear all % Clear all variables and functions from memory
close all % Closes all the graph
grid on % turns on the grid for the axis
Also, you can give figure number by "figure(n)" in your code where n is a integer.