Problem with meshgrid and 3D graphics
3 views (last 30 days)
Show older comments
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;
0 Comments
Answers (1)
Star Strider
on 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 Comments
Star Strider
on 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.
See Also
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!