Why does plotting nans in 3D cause problems with time and ability to save the plot?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
The following script illustrates my problem - when iFloorRem=0 there is no problem with running the script and when it is finished I can save the graph as a *.eps file. When iFloorRem=1 then it takes significantly longer to run and then a long time to actually produce the graph. While that is happening Matlab is locked up. When the graph has been finally produced it takes an extremely long time to save it during which time Matlab is also locked up. For the problem that I am working on, which is more complicated than the script below, it takes so long that I have not been able to complete the save action. I have to use task manager to shut down Matlab to regain control of the computer. I have a Toshiba Qosmio with the I7 chip.
Here is the script:
% Example Script illustrating effect of plotting nans
close all
clear
iFloorRem=1; % set this to 1 to remove the floor, otherwise set to 0
Fs=44100; % sampling frequency
h=1/Fs; % sampling interval
tMax=1; % duration of sample
t=0:h:tMax; % time grid
nt=length(t);
noKeys=50; % number of sinusoids
y=zeros(noKeys,nt); % reserve some room
f=2; % initial frequency
delF=2; % increment in frequency
%===generate the noKeys sinusoids
for k=1:noKeys
y(k,1:nt)=sin(2*pi*t*f);
f=f+delF;
end
if iFloorRem==1
%=== remove floor
[rr, cc]=size(y);
II=y<0;
y(II)=nan;
end
%===plot the sine waves in 3D
for k=1:noKeys
kp=k*ones(nt,1);
plot3(kp,t,y(k,:),'k')
if k==1
hold
end
end
grid
title('A Bunch of Sinusoids')
zlabel('amplitude')
xlabel('sinusoid number')
ylabel('time (s)')
view(37,82)
2 comentarios
Walter Roberson
el 9 de Feb. de 2014
Could you experiment with setting the locations to -inf instead of nan ?
Respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!