its Pressure amplitude(size 1x32001) against time(size 1x32001) in 6 different location, I have 6 arrays of pressure (6 different places) and time array (same for all 6)

 채택된 답변

Star Strider
Star Strider 2018년 7월 20일

1 개 추천

I am not certain what you want or what your data actually are.
Try this (with your data, not my created data):
N = 25;
time = linspace(0, 1, N); % Row Vector - Created Data
location = linspace(0, 36, 6);
pressure1 = sin(2*pi*time*N + rand); % Row Vector - Created Data
pressure2 = sin(2*pi*time*N + rand);
pressure3 = sin(2*pi*time*N + rand);
pressure4 = sin(2*pi*time*N + rand);
pressure5 = sin(2*pi*time*N + rand);
pressure6 = sin(2*pi*time*N + rand); % Row Vector - Created Data
pressure = cat(1, pressure1, pressure2, pressure3, pressure4, pressure5, pressure6);
figure
surf(time, location, pressure)
grid on
xlabel('t (s)')
ylabel('x (cm)')
zlabel('P (kPa)')
colorbar(gca, 'westoutside')
This approach concatenates your pressure data vectors to create the matrix the surf function needs for the third argument. You can use vectors for the x and y coordinates.

댓글 수: 2

Thank you so much for your help...so it becomes like the attached image. Because of the number of the points (32001), it becomes completely black. Is there any way that I can solve that?
many thanks,
With a dense plot, the colours of the patch edges become dominant. The easiest way to deal with that is to turn off the 'EdgeColor' property.
Example
figure
hs = surf(rand(500));
set(hs, 'EdgeColor','none')
grid on
See the documentation on Surface Properties (link) for details on this and other properties you can tweak.
Another option is to interpolate the colours.
Example
figure
surf(rand(500))
shading(gca, 'interp')
grid on
See the documentation on the shading (link) function for details.
The plots these produce are slightly different. Experiment to get the result you want.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Color and Styling에 대해 자세히 알아보기

질문:

2018년 7월 20일

댓글:

2018년 7월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by