简体   繁体   中英

Plot function in 2D intensity plot in matlab

I'm trying to visualise a function into a more intuitive color-coded plot, which can be used into a image. I try to visualise the range in which fluorescent proteins can efficiently transfer energy from one to another. A very important factor in this process is the distance between the two proteins. Therefore I want to plot the theoretical graph of energy transfer as a function of distance on top of one of these proteins. I would like to have an 2D intensity plot which I can use to incorporate into my protein model.

The function describing efficient energy transfer is:

E = R^6/(R^6+r^6)

E = efficiency of energy transfer

R = Förster distance 50% chance of transfer

r = actual distance between the fluorescent proteins

Low values for r cause high values of E, meaning efficient energy transfer --> Green High values for r cause low values of E, inefficient energy transfer --> red

My question is if someone can help me to transform the graph into a color-coded circle, where the middle of the circle corresponds with high E (green) and the borders are more red.

So far, I tried the mesh + surf function, but these require a matrix so that doesn't work.

I appreciate all your help, thank you for your replies!

Cheers, Reinier

If I understand correctly then

[R r] = meshgrid( 0.1:0.1:5 ); % define 2D inputs
E = (R.^6)./( R.^6 + r.^6 );   % compute 2D function
figure;
surf( R, r, E, 'EdgeColor','none'); % plot using surf
xlabel('R');
ylabel('r');
colormap( [ 1:-0.05:0; 0:.05:1;  zeros( 1, numel(0:.05:1) )]' ); % colormap red->green

What you get is 在此处输入图片说明


If you want to plot the 2D function E( x,y ; R=5.1 ) with r(x,y) = || x - y || r(x,y) = || x - y || then you can try

[X Y] = meshgrid(-120:1:120); % x,y range -120:120 nm
r = sqrt( X.^2 + Y.^2 );
R=5.1; % fixing R to 5.1 nm
figure;
surf( X, Y, (R.^6)./( R.^6 + r.^6 ), 'EdgeColor','none');
xlabel('X[nm]');
ylabel('Y[nm]');
zlabel('E');
colormap( [ 1:-0.05:0; 0:.05:1;  zeros( 1, numel(0:.05:1) )]' );
colorbar;

In that case you'll get 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM