How to create Matlab movies to compare constellations
Recently, I made a comparison of the effects of Carrier Frequency Offset (CFO) on Filterbank Multicarrier (FBMC) and OFDM. They behave quite differently on CFO, and this can be illustrated by plotting the received constellation diagram of both modulation schemes while increasing the CFO. This is possible with the movie command in Matlab, but if you want to use in a presentation for instance, an MPEG file might be more handy. Creating MPEG movies is easy with mpgwrite. This is how to do it:
Fist of all, open a new figure in the Matlab command window:
fig1 = figure(1);
Resize the figure. Two subplots will be put next to each other, so make it broad enough. After this is done, the following code (based on this) is executed:
winsize = get(fig1,'Position'); winsize(1:2) = [0 0]; numframes = 351; % For CFO = 0:0.001:0.35 A = moviein(numframes,fig1,winsize); set(fig1,'NextPlot','replacechildren') for i=1:numframes % Plot the constellation diagram for FBMC subplot(1,2,1), plot(real(fbmccfo(:,i)),imag(fbmccfo(:,i)),'.'); title('Received Constellation: FBMC'); xlabel('In phase'); ylabel('Quadrature'); xlim([-1.5 1.5]) ylim([-1.5 1.5]) % Plot the constellation diagram for OFDM subplot(1,2,2), plot(real(ofdmcfo(:,i)),imag(ofdmcfo(:,i)),'.'); title('Received Constellation: OFDM'); xlabel('In phase'); ylabel('Quadrature'); xlim([-1.5 1.5]) ylim([-1.5 1.5]) A(:,i)=getframe(fig1,winsize); end mpgwrite(A,jet,'cfo.mpg');
The columns of fbmccfo and ofdmcfo contain the received constellation points when a certain CFO was added (CFO = 0:0.001:0.35). The resulting constellation movie cfo.mpg is shown right below.
Discuss - No Comments