Problem with meshgrid and 3D graphics

조회 수: 2 (최근 30일)
loredana
loredana 2015년 2월 17일
댓글: Star Strider 2015년 2월 18일
Hello i have this script and i want to realize a 3d graphics
t=logspace(-2,3.5,100);
r= 400 * 1e-6:2:600 * 1e-6;
[R,T]= meshgrid(r,t);
RIC = 100;
kf = 0.2;
kr = 10;
rn = 10 * 1e-6;
D = 2100 * 1e-12;
Q = 2.5e4;
v = (4/3) * pi * (rn^3);
y = ((Q ./ ((4*pi*D.*T).^(3/2)) ) .* (exp(-(R^2)./(4*D.*T)))) * v;
a = kf*RIC*exp(-kr*T);
z = conv(y,a);
hSurface=surf(R,T,z);
set(hSurface,'LineStyle','none');
colorbar;
title('Valore della concentrazione massima in funzione del numerodi molecole e della distanza','FontSize',15)
ylabel('TEMPO','FontSize',15);
xlabel('DISTANZA','FontSize',15);
zlabel('Concentrazione [mol/\mum^3]','FontSize',15);
set(gca,'FontSize',14);
grid on
But there are these mistakes: ??? Error using ==> surf at 78 Z must be a matrix, not a scalar or vector.
Error in ==> prova at 14 hSurface=surf(R,T,z);
Error in ==> prova at 11 y = ((Q ./ ((4.*pi.*D.*T).^(3/2)) ) .* (exp(-(R^2)./(4.*D.*T)))) .* v;

답변 (1개)

Star Strider
Star Strider 2015년 2월 17일
Your ‘r’ variable needs to be a vector in order for meshgrid to produce matrix outputs.
It is currently a scalar.
  댓글 수: 2
loredana
loredana 2015년 2월 18일
I don't know matlab very well... how can i resolve this problem?
Star Strider
Star Strider 2015년 2월 18일
I have no idea what you’re doing, so I can’t be specific. You simply have to create a vector for it.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by