pcolor

5 次查看(过去 30 天)
Daniel
Daniel 2011-6-7
Hi dear MATLAB user,
Im making a FDTD (acoustic preassure) model and at the end of each calculation representing the preassure. The problem is by wieving the contours, it only represents the actual preassure but if the wave hasnt arrived yet you wont see nothing from the contours.
for ...
for ...
end
...
pcolor((1:nx)*dh,(1:ny)*dh,10*log10(min(max(pp'.^2,1d-6),1)) );
shading flat,axis equal; colorbar; title(['time=' num2str(round((tt+maxtt*(ttt-1))*1000*dt)) ' ms']);drawnow
hold on
[x,y]=find(mapaz == 0);
contorno=plot(x,y,'+k');
set(contorno,'MarkerSize',10);
hold off
drawnow
end
Im trying to draw the contours stored in matrix 'mapaz': 0 = contour; 1 nothing.
nx and ny are the sizes of the matrix (1600x1200)
I really don't know to mix this together. Could you help me?
Thanks, Daniel Serra

采纳的回答

Walter Roberson
Walter Roberson 2011-6-7
Perhaps
contour((1:nx)*dh, (1:ny)*dh, 0 + (mapaz ~= 0), [1 1])
  1 个评论
Walter Roberson
Walter Roberson 2011-6-7
I just realized that I should probably have used == 0 instead of ~= 0

请先登录,再进行评论。

更多回答(1 个)

Daniel
Daniel 2011-6-7
Thankyou very much! It worked fine :)
I had to transpose 0 + (mapaz ~...) and it worked fine.
Here is the final code if someone needs it.
Where:
nx,ny = 1, 2, 3...
dh = 0.01 % 1 cm
mapaz = matrix with 0 and 1
CODE:
contour((1:nx)*dh, (1:ny)*dh, (0 + (mapaz ~= 0))', [1 1])
hold on;
pcolor((1:nx)*dh,(1:ny)*dh,10*log10(min(max(pp'.^2,1d-6),1)) );
shading flat,axis equal; colorbar; title(['time=' num2str(round((tt+maxtt*(ttt-1))*1000*dt)) ' ms']);drawnow
Thanks!
  1 个评论
Walter Roberson
Walter Roberson 2011-6-7
You might not have to add the 0, but I put it in for safety.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by