All posts by Ankur
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');
Plotting Liner and Circular Convolution with MATLAB
Implementation of Bottom-Up (Shift-Reduce) Parsing in C++
This program implements a basic shift-reduce parser for parsing expressions based on given grammar rules. It reads a set of production rules and an input string, then attempts to reduce the input to the start symbol.
The process follows these steps:
- Shift input symbols onto a stack.
- Attempt to reduce the top of the stack based on the given production rules.
- Continue until the entire input is processed and reduced to the start symbol.
Implementing Lexical Analyser in C++
Here is C++ implementation of Lexical analyser (a phase of compiler).
Implementing Code Generator in C++
Here is implementation of Code generation stage of complier in C++. You have to provide input in AIP.TXT file and the output will be stored in ANOP.TXT file.