Tag Archives: source

Star / Asterisks Operator ( * ) in Python – 1

1. Unpacking iterables into a list/tuple In addition to serving as the symbol for multiplication, the star operator (*) in Python has several other applications. The first application is unpacking iterables into a list/tuple Example: Adding (appending) elements to an … Continue reading

Posted in Linux, Machine Learning, Python, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

3D Rotations using Rodrigues Rotation Formula

The problem we are addressing here is the rotation of a general 3D vector about a given axis of rotation denoted by by radians. The Rodrigues Rotation Formula is as follows: Example: for a sanity check we can consider that … Continue reading

Posted in Machine Learning, Robotics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Quaternions – Use them for Rotation and Transformation

This is the second tutorial on Quaternions. In the previous post, I explained how to use basics of quaternions from the pyquaternion python library. Check the previous post here. In this post, I will show you how to perform spatial … Continue reading

Posted in Linux, Machine Learning, programming, Python, Robotics, ROS, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Compress files in MATLAB without other file compression software – Method 1, ZIP-UNZIP

You can easily zip a file (or a set of files) in MATLAB without requiring any external compression software being installed on your machine. This is useful to be able to compress files while still in MATLAB. In this post, … Continue reading

Posted in Linux, MATLAB, programming, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Argument handling in MATLAB functions – using default values

When writing functions in MATLAB sometimes the function requires a number of arguments some of which can have default values. So when the arguments are given, they overwrite the default arguments. Consider the following example: First of all, we can … Continue reading

Posted in Linux, MATLAB, programming, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

MEX file in MATLAB – Part 1

In this tutorial I will show you a very simple example of a MEX file in MATLAB. A MEX file is a compiled version of a C/C++ code written and compiled in MATLAB that can be used/executed as an M-file. … Continue reading

Posted in C/C++, Linux, MATLAB, programming, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Investigating code performance in MATLAB – Part 1: For-loop

Here I want to show you a very simple example in MATLAB. Consider we have a large matrix (can be an image also) and we want to perform element-wise operation on the matrix elements. Let’s first create a large matrix: … Continue reading

Posted in Linux, MATLAB, Optimization, programming, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 4 Comments

Update status of your code output in one line (MATLAB)

Consider you want to report the status of your code in the command-line, but you do not want to print a new line each time. For instance, to show the percentage of the progress at the same line from 0%, … Continue reading

Posted in Linux, MATLAB, programming, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Sampling from Normal (Gaussian) Distribution in MATLAB

Sampling from Normal Distribution for a single variable Consider you want to sample 1000 points for a single variable from a normal distribution with mean equal to 5 and standard deviation equal to 1. The easiest way is using normrand … Continue reading

Posted in Linux, Machine Learning, MATLAB, programming, Robotics, Software, Statistics, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Find if an element is repeated exactly m times in a vector

Check if some elements of the vector are repeated exactly m times. To do so, we can use two very useful funcitons, namely ‘unique’ and ‘ismember’. The former creates a new array from the input array including only its unique … Continue reading

Posted in Linux, MATLAB, programming, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment