How can I draw a 3D Free Energy Diagram from a text file which has 3 columns?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
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
채택된 답변
sixwwwwww
2013년 10월 28일
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
Hi, Thank you for your response. I tried doing this and the plot resulted in a line. I want to project it as a contour.
I am trying to plot a data like this:
Here is the code for desired plot:
ID = fopen('filename.txt');
data = textscan(ID, '%f%f%f');
fclose(ID);
x = data{1};
y = data{2};
z = data{3};
indminx = find(ismember(x, min(x)));
indmaxx = find(ismember(x, max(x)));
reshape_range = indmaxx(1) - indminx(1) + 1;
X = reshape(x, reshape_range, []);
Y = reshape(y, reshape_range, []);
Z = reshape(z, reshape_range, []);
surf(X, Y, Z), xlabel('RMSD to average'), ylabel('Radius to gyration'), zlabel('Gibbs free energy'), colorbar
I hope it is working now. Good luck!
Thank you very much indeed. The code works perfectly fine. I was wondering if you could help me out some more with this plot? I am sorry to bother you with silly questions but my ignorance with MATLAB doesn't help much. If I want to plot a 2D contour plot of this same data and then find the co-ordinates at each particular point preferably of the valleys/ low free energy valleys as obtained via the 3d plot? How can I go about that?
I really appreciate your kind help
You are welcome. You can see 2D contour plot of this data as follows:
contour3(X, Y, Z), xlabel('RMSD to average'), ylabel('Radius to gyration'), zlabel('Gibbs free energy'), colorbar, view([180 90])
You can find energy values and their respective 'x' and 'y' coordinates in sorted order as follow:
Matrix = [x, y, z];
Matrix = sortrows(Matrix, 3);
Is it what you needed?
Thank you for helping me out. The contour plot worked and I was wondering if I need to fill it like have it filled with color, do I need to change the color bar? Regarding the energy values, actually I am looking forward to something like Inspecting the FEL and finding where the Free Energy is minimal ('valleys'). Then I want to Select a few 'valleys' that would be representative. And if I can check which coordinates these correspond by right-clicking the 2D contour plot and selecting something which can "Get Coordinates" and then move mouse over the plot and it shows the coordinates at each particular point. These coordinates then I can trace back to find timestamps from my input file.
I know I am being quite specific and detailed but I am completely clueless to working around with MATLAB.
You are welcome. Contour plot just plot the boundary lines. You can see for more information: http://www.mathworks.de/de/help/matlab/ref/contour3.html
I basically don't know about FEL. You can use data cursor to see the energy values and their respective x and y coordinates on the contour plot. In order to trace back the timestamps you may need to use 2D interpolation. You can find information about it here: http://www.mathworks.de/de/help/matlab/ref/interp2.html
I hope it helps. Good luck!
You are welcome. Contour plot just plot the boundary lines. You can see for more information: http://www.mathworks.de/de/help/matlab/ref/contour3.html
I basically don't know about FEL. You can use data cursor to see the energy values and their respective x and y coordinates on the contour plot. In order to trace back the timestamps you may need to use 2D interpolation. You can find information about it here: http://www.mathworks.de/de/help/matlab/ref/interp2.html
I hope it helps. Good luck!
Thank you for the link. So, if I want to plot it as a colored 2D, I need to use something other than contour, right? Also, I think with the interpolation, I am not quite confident if that would work. All, I want to do is find the co-ordinates of the energy valleys as obtained in the landscape and then corresponding to that co-ordinates, I can try to find other things. I tried to use Data cursoe but it gives the error of callback trace. Have you got a feel for the reason behind this?
Maybe in this case 'meshc' will be helpful for you.
meshc(X, Y, Z), xlabel('RMSD to average'), ylabel('Radius to gyration'), zlabel('Gibbs free energy'), colorbar, view([0 270])
I used data cursor but I didn't get any error. See attachment for this. Good luck!
Hi,
I clicked on data cursor and then right clicked to make data tip but below are 2-3 of the list errors that I receive:
Error using handle.handle/set Invalid or deleted object.
Error in cameratoolbar (line 476)
Error in scribeclearmode (line 29) feval(func,s{2:end});
I personally never experienced such error. Maybe you can try to close and then reopen your MATLAB. Because at this point I can just give you suggestion not an exact solution because I am not getting any of such errors I checked. But if I will have a solution for this then I will come back to it
The error is persisting, I don't know why but nevertheless thank you very much indeed for such a massive and patient help with this plot. I really appreciate your promptness.
Kind regards,
I just wanted to say that I tried several times and now suddenly, my cursor seems to be working. I think it might be some accumulation of errors or just a hack or something. But thank you indeed with your help!
You are welcome. Yes it is also strange for me because I worked with cursor a lot but never encountered such errors. It is good that it is working now. Good luck with your work. Stay happy always
Thank you very much indeed and I just wanted to seek your permission to disturb you directly maybe when I need more help?
Yes you can ask me if I will be able then I will help you
추가 답변 (1개)
suhani nagpal
2013년 12월 16일
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
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
