Effacer les filtres
Effacer les filtres

How can I draw a 3D Free Energy Diagram from a text file which has 3 columns?

9 vues (au cours des 30 derniers jours)
Apologies if the questions of this type have been already asked but I am a complete novice in MATLAB and am seeking help to draw a free energy diagram from a text file which looks like the following: (I have also attached the file) ------------------------------------------------------------------------------ 4.20766 0.13450 15.50000 4.21207 0.13450 15.50000 4.21647 0.13450 15.50000 4.22088 0.13450 14.20000 4.22528 0.13450 11.60000 4.22968 0.13450 12.90000 4.23409 0.13450 14.20000 4.23849 0.13450 15.50000 4.24289 0.13450 15.50000 ------------------------------------------------------------------------------------ There are 16000 rows and 3 columns. The first two are my parameters and third column is the free energy value. I want to plot this data and visualize as a 3D Free energy diagram. As I am novice, I might need a detailed help please.
Kind regards

Réponse acceptée

sixwwwwww
sixwwwwww le 28 Oct 2013
Dear Ankita, you can plot 3 columns of equal length as follows:
ID = fopen('filename.txt');
data = textscan(ID, '%f%f%f');
fclose(ID);
min(data{1})
max(data{1})
plot3(data{1}, data{2}, data{3}, '*-'), xlabel('x'), ylabel('y'), zlabel('Free energy')
I hope it helps. Good luck!
  16 commentaires
Ankita
Ankita le 29 Oct 2013
Thank you very much indeed and I just wanted to seek your permission to disturb you directly maybe when I need more help?
sixwwwwww
sixwwwwww le 29 Oct 2013
Yes you can ask me if I will be able then I will help you

Connectez-vous pour commenter.

Plus de réponses (1)

suhani nagpal
suhani nagpal le 16 Déc 2013
Greetings
I used your reshape script for my test file. The following error is generated:
??? Error using ==> reshape Product of known dimensions, 1641, not divisible into total number of elements, 1681.
Error in ==> untitled at 10 X = reshape(x, reshape_range, []);
Can you please assist regarding this? I'm new to matlab. Thanks

Community Treasure Hunt

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

Start Hunting!

Translated by