Problem with meshgrid and 3D graphics

2 vues (au cours des 30 derniers jours)
loredana
loredana le 17 Fév 2015
Commenté : Star Strider le 18 Fév 2015
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;

Réponses (1)

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

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by