create time-changing graphic contour map

조회 수: 5 (최근 30일)
Samuel
Samuel 2015년 5월 29일
답변: Nelson Ojeda Quiles 2016년 4월 28일
Update-
Maybe to clarify my end result- I have a sample dataset as below- first column denotes the x position, second denotes y position, and third column is the temperature value recorded. (That is why the x and y position number isn't changing)
The row is with respect to time from t=1-3s.
5 5 10
5 5 20
5 5 30
10 10 30
10 10 50
10 10 1
15 15 4
15 15 10
15 15 20
I was hoping to output a 3d surface graph like shown below
So x y coordinates will show, and z will be the temperature. I was hoping to generate an animation that will show the changes in temperature on these respective locations.
Any clarifications and/or advice will be greatly appreciated. Thanks.
previous post------------------------------------------------------------------
Hi, I have a time-resultant 100 point sensor output of temperature at 4 different places in a device. I want to see a graphical contour map so that I can a color based change for each point as time passes, preferably from blue (cold) to red (hot). Research in to past threads and online showed that maybe using surf() and/or pcolor() functions will do it. However, when I try to use the data I have, it gives me an error.
What I tried so far is to assign a 2x2x100 array to each point. What I want to do is also assign each of them to a graphical coordinate indicating the points at where I installed this sensor.
thanks for the help in advance
.

답변 (2개)

Mischa Kim
Mischa Kim 2015년 6월 3일
Samuel, use something like
[X,Y,Z] = peaks(50);
figure
h = surf(X,Y,Z);
axis manual
for ii = 0:200
h.ZData = Z + rand(size(Z)); % replace by sensor data
pause(0.1)
end
  댓글 수: 2
Samuel
Samuel 2015년 6월 3일
편집: Samuel 2015년 6월 3일
Hello Mischa, thanks so much for your reply- you have been more help than a Mathworks support rep.
I am afraid I might need some more details on the suggestion you provided. My actual data is a set of them with no actual locations defined- it is an array of temperature outputs.
I will attempt to comment my intrepretation of the portion of code. Please advise / correct my understanding as you see fit.
[X,Y,Z] = peaks(50);% this is to create an example plot
figure
h = surf(X,Y,Z); %plot actual data
axis manual %take control of plotted data?
for ii = 0:200 % is this based on the size of my temp data, or a random number?
h.ZData = Z + rand(size(Z)); % replace by sensor data - I noticed putting my table of numbers here created a warning ("Warning: Error creating or updating Surface
Error in value of property ZData Array is wrong shape or
size ")
pause(0.1) %this is to pause it at a certain frame?
end
Thanks in advance for your help. sam
Mischa Kim
Mischa Kim 2015년 6월 3일
[X,Y,Z] = peaks(50);
figure
h = surf(X,Y,Z); % plot the first set of data
axis manual % this way the scales do not change
for ii = 0:200 % now animate; use 200 (random, correct)...
% ...time steps or data sets
h.ZData = Z + rand(size(Z)); % replace by sensor data
pause(0.1) % nope. to slow it down. you loop through...
% ...draw > pause > draw > pause etc.
end
As for the warning, did the code still work? If not, attach to your comment your x-, y-, and z-data as a .mat file and we can figure this one out as well.

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


Nelson Ojeda Quiles
Nelson Ojeda Quiles 2016년 4월 28일
I am trying to do the same, but with a 9 sensor setup. I just have Temperature/ Time(minutes)/ Sensor location, this code just makes my plot flicker. Should I change something?

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by