Problem with meshgrid and 3D graphics

2 Ansichten (letzte 30 Tage)
loredana
loredana am 17 Feb. 2015
Kommentiert: Star Strider am 18 Feb. 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;

Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by