Continue reading Implementing Digital Negative and Grayscale of Image in MATLAB
Category Archives: DSIP
Implementing Digital Negative of Image in MATLAB
Plotting sin and cos Function in MATLAB
Plotting Unit Impulse, Unit Step, Unit Ramp and Exponential Function in MATLAB
In this blog post, we will explore how to plot basic discrete-time signals in MATLAB, including the Unit Impulse, Unit Step, Unit Ramp, and Exponential Function. These fundamental signals are commonly used in signal processing and control systems.
Below is a MATLAB script that plots these four signals using the stem()
function, which is used to display discrete-time signals.
t=-2:1:2;
y=[zeros(1,2), ones(1,1), zeros(1,2)];
subplot(2,2,1);
stem(t,y);
ylabel('d(n)');
xlabel('unit impulse');
n=input('Enter n values');
t=0:1:n-1;
y1=ones(1,n);
subplot(2,2,2);
stem(t,y1);
ylabel('Amplitude');
xlabel('unit step');
n=input('Enter n values');
t=0:1:n-1;
subplot(2,2,3);
stem(t,t);
ylabel('Amplitude');
xlabel('unit ramp');
n=input('Enter length of exponential seq');
t=0:1:n-1;
a=input('Enter a value');
y2=exp(a*t);
subplot(2,2,4);
stem(t,y2);
xlabel('Exponential fun');
ylabel('Amplitude');