3D PLOT please help

16 次查看(过去 30 天)
francis
francis 2013-7-6
移动DGM 2023-12-29
x=0:0.1:1000;
y=70:0.1:320;
z=4*pi*((0.032./(2.*pi.*8.31.*y)).^(3./2)).*
(x.^2).*exp((-0.032.*x.^2)./(2*8.31.*y));
plot3(x,y,z)
xlabel('Molecules Speed(m/s)'); ylabel('Temperature(K)'); zlabel('Probability');
this is the problem: Make a 3d plot of P(v)as a function of v and T for 0<v<1000 and 70<T<320
Molecules of gas in a container are moving at different speeds. Maxwell speed distribution law gives a probability P(v)
P(v)=4pi(M/(2piRT))^(3/2) * v^2 *e^((-Mv^2)/(2RT))
M=0.032
R= 8.31
this is the error I get
??? Error using ==> times
Matrix dimensions must agree.
Thanks for the feedback and help

采纳的回答

the cyclist
the cyclist 2013-7-6
To plot over a range of (x,y), you need the complete grid of coordinates. You can use the command meshgrid() to do this:
[xx,yy] = meshgrid(x,y);
Calculate z from xx and yy instead of x and y.
You probably want to decrease the granularity of your grid, otherwise you have way too many points to plot. It looked pretty good when I did
x=0:10:1000;
y=70:1:320;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by