Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Please help, 3D plot
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
Réponses (1)
Cyril GADAL
le 16 Mai 2017
Modifié(e) : Cyril GADAL
le 16 Mai 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 commentaire
Cyril GADAL
le 16 Mai 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.
Cette question est clôturée.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!