Info

This question is closed. Reopen it to edit or answer.

Please help, 3D plot

1 view (last 30 days)
Nikita Johnson
Nikita Johnson on 21 Apr 2017
Closed: MATLAB Answer Bot on 20 Aug 2021
I have to collect and combine values between 20°C and 25°C which are distributed inside aroom in 3D., Now the temperature which are between (+ - 0.5), will come together. I have created a meshgrid for the temperature distribution. Would there be any way to run a "for loop" and at the end plotting the zones at the end together.
  2 Comments
Rik
Rik on 21 Apr 2017
I expect so. Why don't you try something and when that fails come back here and explane what problem you are having.
Tina
Tina on 16 May 2017
How is your data structured? Can you give us the code that you already have so that we understand better what your problem is?

Answers (1)

Cyril GADAL
Cyril GADAL on 16 May 2017
Edited: Cyril GADAL on 16 May 2017
Hello,
As we don't have a lot of details on how your Temperature array, It's hard to give you a defined solution. However, you should definitely look at the function scatter3 which will allow you to plot points giving (X,Y,Z) coordinates. You can also specify a color to this points based on another vector (here the Temperature) : This should give you what you expect.
If you insist on plotting some zones 1 by 1, you can do something like this :
figure
for i = 1:N
scatter3(X,Y,Z(i))
hold on
end
where Z(i) will be the zone i.
  1 Comment
Cyril GADAL
Cyril GADAL on 16 May 2017
Your problem is pretty hard to understand, without the data. I'll start from the point where you have a 3D grid with a temperature value for every point. I won't write the full algorithm, but give you the step I would use :
Creating Temperature zone
Tmax = max(Temp(:))
Tmin = min(Temp(:))
Tval = Tmin : 1 : Tmax %%Temperature boxes
Then you just have to find in the array these temperatures, so I would do something like : for the temperature t :
[Val,Ind(i)] = find( abs(Temp - Tval(i)) <=0.5)
You will obtain from this linear index that you may convert in usuall indexes using ind2sub (I let you check how to do it) to obtain the coordinates.
So at this point you should know the indices of where are each temperature zone. Then you just have to check for each of these zones if every cells are next to each other (so it is only one zone), or not (so it is different zones).
I hope I gave you some ideas to simplify the problem, because I tried to read and understand the your script but it's too hard without the data and trying things.

Products

Community Treasure Hunt

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

Start Hunting!