Problem with meshgrid and 3D graphics

3 ビュー (過去 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 Center および File ExchangeSpline Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by