## matlab generate the same random number everytime

use the following command before the rand function, you will get the same random number everytime you run the m file.

rand(‘seed’, 0);

rand

## Set latex font

The command is:

\renewcommand*\rmdefault{ptm} %ppl

if you want to understand the three letter word: ptm or ppl. Read the table III of this document: http://tug.ctan.org/macros/latex/required/psnfss/psnfss2e.pdf

Here is a good introduction:

## Abbrivation

Theorem -> Thm.

Corollary -> Cor.

See https://en.wikipedia.org/wiki/List_of_mathematical_abbreviations

Chapter -> Chap.

see https://en.wikipedia.org/wiki/List_of_legal_abbreviations

## Insert Youtube video to powerpoint

**Keywords: youtube, video, PPT, powerpoint, starting time**

- First, go to youtube and find the video. Then click Share->Embed. You will get a code as below:

- Second, paste the code to word and modify it. Specify the starting and ending times as shown below.

- Third, go to PPT and click Insert->Video->Online Video->From a Video Embed Code (not the Youtube one). Copy and paste and nail it.

## Bearing Laplacian: Matlab code

Bearing Laplacian is important in the area of bearing rigidity. Here is the matlab code to generate the bearing Laplacian of a given network. If the rank of the bearing Laplacian is equal to d*n-d-1, then the network is bearing rigid.

keywords: bearing rigidity, bearing Laplacian

clc;clear;close all % positions of the nodes in the network p_all=[0 0 0; 0 1 0; -1 0 0; 0 0 1]'; d=size(p_all,1); % dimension n=size(p_all,2); % number of nodes % The symmetric adjacent matrix neighborMat=zeros(n,n); neighborMat(1,2)=1;neighborMat(1,4)=1; neighborMat(2,3)=1; neighborMat(3,4)=1; neighborMat=neighborMat+neighborMat'; % Calculate the bearing Laplacian L L=zeros(d*n,d*n); for i=1:n for j=1:n if neighborMat(i,j)~=0 && i~=j pi=p_all(:,i); pj=p_all(:,j); gij=(pj-pi)/norm(pj-pi); Pgij=eye(d)-gij*gij'; L(d*(i-1)+1:d*(i-1)+d,d*(j-1)+1:d*(j-1)+d)=-Pgij; L(d*(i-1)+1:d*(i-1)+d,d*(i-1)+1:d*(i-1)+d)... =L(d*(i-1)+1:d*(i-1)+d,d*(i-1)+1:d*(i-1)+d)+Pgij; end end end % See if the rank of L is equal to d*n-d-1. If so, the network is bearing rigid rank(L)-(d*n-d-1)

## A special but useful orthogonal projection matrix

## matlab annotation

x=[0.25,0.25];

y=[0.45,0.32];

a=annotation(‘textarrow’,x,y,’String’,’x_{2}(t), x_{14}(t)’);

set(a, ‘color’, myRed, ‘interpreter’, ‘tex’, ‘fontSize’, 15)