Smart Work

Can we get more things done in less time? Or is it just a fallacy?. There is a lot of productivity gurus on the internet. I am reflecting on my thoughts on this topic here. We might unanimously agree that in our world there are more productive people and people who are less productive. Some people solve problems quickly, get things done on time. What is essentially separating productive people from non-productive ones?. Are productive techniques adoptable?

One of the main things here is time management. How good are you in managing time. Until yesterday I didn't seriously think about the time it takes any task to be done by me. How much time am I spending on brushing, reading one page, etc. I have found planning extremely helps but never thought of time as a precious commodity I have. Assuming an average healthy human being we live for some years and every second is passing by. Yes, time is a very precious commodity. I am not intending that we need to worry about it all time but make sure we are using it at its best.

As I am embarking my journey to polish my skills. The first course I am trying is 'work smarter not harder' from Coursera. I am going to reflect on the ideas I learn from there here.

Am I able to distinguish whether I am doing a productive or unproductive task? Is there an efficient way to do a particular task. How much is my will power to stick on to one particular task?. It is said that having a plain make you productive in three ways. What are those three aspects?. How can I break up a big task into small easy tasks?. Do you have a better skill to prioritize tasks?. Do I understand my work habits and my expectation on work life balance?. Is there a change in my productivity depending on the time of the day?.


At the end of the day If I am unable to explain or uncertain about where did all the time went that day, then it is a sign of unproductive work. While writing the task list the columns could be the priority, task name, start and end time, due date, etc.

Killer Combinations

I always asked myself what is the best way to do various things. I mean to do more in less time and an efficient manner. Things like how to study better?. How to think better?. How to manage time better?. How to solve problems quickly?. How to wake up early?. Such questions are always exciting to me. To be frank I might have spent many hours searching answers for such questions. I got a few answers here and there which I am going to share here. I would like to call them killer combinations. 

By this I mean two things or activities which might seem unrelated yet doing one thing improves the other. 
  1. Writing----------------------------------------------Thinking
  2. Teaching---------------------------------------------Learning
  3. Questioning-----------------------------------------Focusing
  4. Visualizing------------------------------------------Understanding
  5. Big picture ------------------------------------------Breaking down things
  6. Intuitive Understanding---------------------------Ideas
  7. Taking break----------------------------------------Solving problems
  8. Plan --------------------------------------------------Save time


The first one in this is writing and thinking. Writing helps us to think better, organize our thoughts. The second one is teaching and learning. These days it is called in the name of the Feynman technique. Ask yourself what is the names of subjects you studied in your Bachelors/Masters? Can't recollect fully? Chances are high for you to explain the whole concept in which you took the college seminar even today!. Teaching makes one learn better. As Einstein and Feynman said if you can't teach it then you don't understand it. 

Another technique is to ask questions on a topic to kick start your brain and focus on the topic. Questions can be never-ending and you may not find answers for most of the questions but still, it is extremely helpful. Visualizing helps us to remember and absorb things very fast. I always think in terms of some visuals. If I can't come up with a visual image, a piece of text or book or equation, a vague memory of these take place for the visual representation.

If you have a big picture of a concept that can write a computer program for something then it means you can modularise it into individual blocks. In fact, breaking down a large thing into individual components is a valuable skill in troubleshooting. I have experienced this is troubleshooting hardware issues/bugs. Having an intuitive understanding of something helps us to come with good ideas on unexpected occasions. Another one I faced is when we are stuck at some problem for a while, without much hope in solving it. Taking a break and articulating our problem to someone else along might show us the answer from somewhere. Having at least a rough plan and todo list saves time and improves productivity.

All these could be personal, I may be different from someone else but there could be someone like me benefiting from these!. All these might seem miracle but I have experienced these many times. The idea here is why don't we practice these in different aspects (e.g. solving problems in life). This list here is not exhaustive. I will revisit and update as I remember more of these. I hope these would work for someone else also.

Thinking Tools


These days I am in search of my passion or career. Last week I resigned from a software engineer job. Although I kind of failed (as per the feedback I got from my bosses) in performing well in the job, I started realizing the need to work on my efficiency, thinking, and reasoning abilities. That experience was a chance to gauge my abilities in these skills. I was shocked to understand that my communication abilities were poor especially understanding messages in the correct sense. I was impressed by the thought process of my bosses, the clarity in their thought, how they strive towards the big picture, how they always think in terms of the ultimate goal and product we were working on.

Even though I spent 5 years in academic research I kind of sadly realized that my skills are below the bar of an employer. This could be a special case. Some other employers might still find my skills good enough but still a feeling struck me telling me I need to improve!.

This experience motivated me to make some serious attempts to work and polish on these skills. As always I looked into the world of MOOCs to see if there are any structured courses to develop these skills. And yes there is, I found many. Overall the categories are mainly communication, critical thinking, time management, design thinking, computational thinking, model thinking, and analyzing complexity. I decided to delve into these and learn and improve as much as I can.

One of the techniques I found effective is to write my thought. That is what I am doing here. Possibly in the next 2-3 months, I plan to think and write on various things as much as possible. I will be writing on whatever I learn, reflecting my thoughts here. Because I don't think I may not get another chance to do like this anywhere after 6 months. I intend to improve where I am very weak, identify and polish the skills I already have. I understand these skills are essential for a successful career no matter whichever field I am will be in future. Structured training on these concepts is absolutely vital for any global citizen. With that being said I stop this introduction here. I hope this writing snippets will be useful for someone else in the world also.

Thoughts On Adaptive Filtering Algorithms




Thoughts On Adaptive Filtering Algorithms

Adaptive filtering algorithms have been used in wide areas including communication, signal processing,
control systems, biomedical, etc. A basic thought about adaptive filtering and its principles is needed for
the proper understanding of allied techniques. In the field of ANC, I have encountered manly Least
Mean Square (LMS) and Filtered-x LMS. 

Some thoughts around which these ideas can be framed as follows. Why should one go for adaptive
filtering? why don't normal filtering alone would fine?. How adaptive the so-called adaptive algorithm
would be? Is there a measure or metric for the adaptiveness property? What is the difference between
LMS and Recursive Least Squares (RLS) algorithm will be?. What are the assumptions around which
adaptive algorithms are framed upon?. Are they guaranteed to converge in all cases?

RLS Detour

The Wikipedia page of RLS says a few important points about its characteristics. The cost function is
the least squares. Does that mean it is not taking the mean value like in LMS?. One assumption for
RLS is that the input signal is considered to be deterministic. If that is the case then why would we
need to predict the signal at all? or Am I missing something big here?. In LMS the input signals are
considered to be stochastic. RLS offers fast convergence compared to its competitors at the cost of
computational complexity. One surprising thing I learned was that the inventor RLS is Gauss!.
Why and at what part computational complexity comes is to be explored.

Inset Plotting with Matplotlib

Here in this article, I am trying to explain the process of creating inset pictures within Python plots. In many cases of data visualization, we need to make the best use of available space for plots. In my experience, each plot is unique in its own way so that few improvements here and there makes it visually more pleasing and we will be able to convey more information using minimum space. Here I am plotting Energy Decay Curve of an audio signal(wav file) with its time domain view in inset.
The first step would be to import the necessary libraries
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile
One of the important parts is to know the dimension(or at least the aspect ratio) of the image you want. I usually take the Golden ratio(1.61) as the aspect ratio. You need to decide the font size also according to the dimension so that labels wont look too big or too small.
width  = 3.5
height = width / 1.618
labelsize = 10
legendfont = 8
lwidth          =   0.8
plt.rc('pdf', fonttype = 42)
plt.rc('font', family='serif')
plt.rc('text', usetex=True)
plt.rc('xtick', labelsize=labelsize)
plt.rc('ytick', labelsize=labelsize)
plt.rc('axes', labelsize=labelsize)
The following code generates the data to be plotted.
inputfile    = 'IRTrimmed.wav'
Fs, x    =   wavfile.read(inputfile)
Fs = float(Fs)
rangetoplot     = 2000
Lp = len(x)
Tp = np.arange(0, Lp/Fs, (1/Fs)).T
Ppower = np.square(x)
PpowerRev = Ppower[::-1]
PEnergy = np.cumsum(PpowerRev)[::-1]
PEdB        = 10*np.log10(PEnergy)
Next, we create a figure object.
fig1, ax = plt.subplots()
fig1.subplots_adjust(left=.16, bottom=.2, right=.99, top=.97)
Now we can plot the main data and label the axes and legend.
plt.plot(Tp, PEdB, ls='solid', color = 'b', label = 'Energy decay curve', linewidth = lwidth)
plt.grid(True, which = 'both', linestyle=":", linewidth = 0.6)
plt.xlabel('Time(sec)')
plt.ylabel('Energy(dB)')
plt.legend(loc='upper right',fontsize = legendfont)
Then we can create an inset inside our main plot and add a graph there.
ax2 = fig1.add_axes( [0.25, 0.25, 0.4, 0.4])
ax2.plot(Tp[0:rangetoplot], x[0:rangetoplot], ls='solid', color = 'k', linewidth=0.5, label ='RIR Time Domain' )
ax2.set_xticks([])
ax2.set_yticks([])
Finally, we can save the plot to a dimension we want.
fig1.set_size_inches(width, height)
fig1.savefig('EnergyRIR.png', dpi = 600)
And the final figure will look like this.
The source code can be found here and the input signal can be found here

Understanding Spectrogram with DTMF Signals

This MATLAB tutorial explains the Spectrogram visualization using DTMF audio as input signal. The code reads, analyzes and plots the spectrogram of a DTMF signal. The time-frequency resolution problem is explained with different frame sizes.


Screen Display Specifications

%Measure screen size of the device
%Calculate position values of figure Windows

scrsz = get(0,'ScreenSize');
P1=[40 500 scrsz(3)/3 scrsz(4)/3];
P2=[40 80 scrsz(3)/3 scrsz(4)/3];
P3=[600 500 scrsz(3)/3 scrsz(4)/3];
P4=[600 80 scrsz(3)/3 scrsz(4)/3];
P5=[1000 500 scrsz(3)/3 scrsz(4)/3];
P6=[1000 80 scrsz(3)/3 scrsz(4)/3];

File Reading

[y, Fs] = audioread('C:\Users\SAJIL\Documents\MATLAB\DTMF1.wav');
L=length(y);
N = nextpow2(L);
T=1/Fs;

Signal Analysis Part

t=(0:T:(L-1)/Fs)';
NFFT = 2^nextpow2(L);
Y = fft(y,NFFT);%/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
Mag=2*abs(Y(1:NFFT/2+1));

Plot Signal

figure('position', P1);
figure(1);
plot(t,y,'k');
grid on
title('Time Domain');
xlabel('Time in Seconds');
ylabel('Amplitude');
legend('DTMF Tone');

Plot single-sided Amplitude Spectrum.

figure('position',P2);
figure(2);
plot(f,Mag);
grid on
title('Magnitude Spectrum');
xlabel('Frequency (Hz)');
ylabel('|X(f)|');
legend('Frequency Spectrum');

DTMF Signal Table

I = imread('DTMF.png');
figure('position',P3);
figure(3);
image(I)
f=text(0.4,0.4,'Original Input is 0696675356','FontSize',12);
axis off

Spectrogram Display Part

figure('position',P4);
figure(4);
%spectrogram(x,window,noverlap,f,fs)
spectrogram(y,32);
text(0.4,28,'Frame Size 32','FontSize',12);
%colormap bone

figure('position',P5);
figure(5);
%spectrogram(x,window,noverlap,f,fs)
spectrogram(y,256);
text(0.4,28,'Frame Size 256','FontSize',12);

figure('position',P6);
figure(6);
%spectrogram(x,window,noverlap,f,fs)
spectrogram(y,512);
text(0.4,28,'Frame Size 512','FontSize',12);
  

Play back block

soundsc(y,Fs);

End of Program

An Intuitive Look Into Auto-Correlation

In this tutorial, we will take a look at the mathematical function called auto-correlation for various  common signals. The basic signals are generated and their respective auto-correlation output is plotted.


Screen Display Settings

%Measure Screen Size of the device
%Calculate position values of figure windows
scrsz = get(0,'ScreenSize');
P1 = [50 500 scrsz(3)/3 scrsz(4)/3];
P2 = [50 80 scrsz(3)/3 scrsz(4)/3];
P3 = [500 500 scrsz(3)/1.5 scrsz(4)/3];
P4 = [500 80 scrsz(3)/1.5 scrsz(4)/1.5];

Generate Basic Signals

figure('position', P4);
figure(1);

Sine Wave

t = 0:(1/1000):1;
x1 = sin(2*pi*1*t) ;
subplot(4,2,1);
plot(x1);
grid on
title('Sine Wave');
xlabel('Samples');
ylabel('Amplitude');

y1 = xcorr(x1,x1);
subplot(4,2,2);
plot(y1);
grid on
title('Sine Wave Autocorr');
xlabel('Samples');
ylabel('Amplitude');

Ramp

x2 = t;
subplot(4,2,3);
plot(t);
grid on
title('Ramp');
xlabel('Samples');
ylabel('Amplitude');

y2 = xcorr(x2,x2);
subplot(4,2,4);
plot(y2);
grid on
title('Ramp Autocorr');
xlabel('Samples');
ylabel('Amplitude');

Rectangular

x3 = ones(1,1500);
subplot(4,2,5);
plot(x3);
grid on
title('Rectangular');
xlabel('Samples');
ylabel('Amplitude');

y3 = xcorr(x3,x3);
subplot(4,2,6);
plot(y3);
grid on
title('Rect Autocorr');
xlabel('Samples');
ylabel('Amplitude');

1 minus x^2

x4 = 1- t.*t;
subplot(4,2,7);
plot(x4);
grid on
title('XSquare');
xlabel('Samples');
ylabel('Amplitude');

y4 = xcorr(x4,x4);
subplot(4,2,8);
plot(y4);
grid on
title('XSquare Autocorr');
xlabel('Samples');
ylabel('Amplitude');

End of Program