# Matlab

# Spaces in strings in matlab/octave

To get spaces in the strings to work in matlab or octave, use t1={‘test test’} Result is t1 = { [1,1] = test test } t2=strcat({‘test test ‘},{‘blah blah’}) Result is t2 = { [1,1] = test test blah blah } you can use this string in your figures by plot([1:4]) title(t2{})

# Radiation from an oscillating dipole

The electric field from an oscillating dipole is given by:, where is the position vector, is the frequency of dipole oscillation, is the dipole moment. The two terms in the electric field consists of 1) near field (area near to the dipole) and 2) far field (area far from the dipole) contributions. Far field falls Read More …

# Smooth image in matlab

In matlab, sometimes I prefer to plot a image for mesh data instead of surf and use view(2) (view(2) gives the top view of the surface plot). However, imagesc(x,y,z) shading ‘interp’ does not work. This problem can be solved by using: pcolor(x,y,z) shading ‘interp’ set(gca,’TickDir’,’out’) .