Why is the plot created using the SCATTERPLOT function not displayed in my SUBPLOT in Communications Toolbox 3.2 (R14SP3)?

I am creating a SCATTERPLOT as follows:
M = 16; Fd = 1; Fs = 10; N = Fs/Fd;
Pd = 200;
msg_d = randint(Pd,1,M);
msg_a = qammod(msg_d,M);
msg_a = rectpulse(msg_a,N);
rcv = rcosflt(msg_a,Fd,Fs);
rcv_a = rcv(3*N+1:end-4*N,:);
%plot my figure
subplot(1,2,1)
plot(1:10,1:10);
subplot(1,2,2)
h=scatterplot(rcv_a,N,0,'bx');
hold on;
scatterplot(rcv_a,N,N+1,'r+',h); % Plot +'s
scatterplot(rcv_a,N,N-1,'mx',h); % Plot x's
scatterplot(rcv_a,N,0,'b.',h); % Plot dots
hold off
The result of the SCATTERPLOT function is displayed in a new figure and not in the SUBPLOT.

 Respuesta aceptada

The ability to display the plot created by the SCATTERPLOT function in a SUBPLOT is not available in the Communications Toolbox 3.2 (R14SP3).
To workaround this issue, execute the following commands in MATLAB:
%Create example data for the SCATTERPLOT
M = 16; Fd = 1; Fs = 10; N = Fs/Fd;
Pd = 200;
msg_d = randint(Pd,1,M);
msg_a = qammod(msg_d,M);
msg_a = rectpulse(msg_a,N);
rcv = rcosflt(msg_a,Fd,Fs);
rcv_a = rcv(3*N+1:end-4*N,:);
%Display the Scatter Plot
h=scatterplot(rcv_a,N,0,'bx');hold on;%obtain handle to the figure
scatterplot(rcv_a,N,N+1,'r+',h); % Plot +'s
scatterplot(rcv_a,N,N-1,'mx',h); % Plot x's
scatterplot(rcv_a,N,0,'b.',h); % Plot dots
hold off
%Since 'h' is handle to the figure, its child should be an 'axis'
c1=get(h,'child')
%obtain x and y limits of the scatterplot
x=get(c1,'xlim');y=get(c1,'ylim')
%obtain the plotted points, which are of type 'line' and children of the
%'axis'. Since there were 4 scatterplots this is 1x4 vector.
c2=get(c1,'child')
%create the subplots
figure(2)
subplot(1,2,1)
plot(1:10,1:10);
h1=subplot(1,2,2)%obain the handle to the subplot. This is of type 'axis',
%since it is a child of the 'figure'.
set(h1,'xlim',[x(1) x(2)],'ylim',[y(1) y(2)])% set the axis limits to those of the scatterplot
%set the parent of each of the 4 'line' objects to h1
set(c2(1),'parent',h1)
set(c2(2),'parent',h1)
set(c2(3),'parent',h1)
set(c2(4),'parent',h1)
title('Scatter plot');Xlabel('In-phase');Ylabel('Quadrature');box on

Más respuestas (0)

Categorías

Productos

Versión

R14SP1

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by