Plotting a Distribution of Molecules
1 view (last 30 days)
Show older comments
Need a figure for c(x,t)
t1=0;
t2=600;
t3=1200;
t4=1800;
t5=2400;
t6=3000;
t7=3600;
D=5e-9;
Co=1;
𝛿(𝑥−𝑥0)→∞ 𝑎𝑡 𝑥=𝑥0, and 𝛿(𝑥−𝑥0)=0 𝑓𝑜𝑟 𝑥≠𝑥0.
where 𝑐(𝑥,𝑡)= (Co/(sqrt(4*pi*D*t1)))exp^(-(x-xo)^2)/(4*D*t))
0 Comments
Answers (1)
Star Strider
on 15 Nov 2020
Specifically:
x = linspace(-5, 5);
y = gradient(erf(x)) ./ gradient(x);
figure
plot(x, y)
grid
.
4 Comments
Star Strider
on 15 Nov 2020
No.
For a 3D plot (for a function with two arguments) use one of the surface plot functions.
t1=0;
t2=600;
t3=1200;
t4=1800;
t5=2400;
t6=3000;
t7=3600;
D=5e-9;
Co=1;
xo = 0;
c = @(x,t) (Co./(sqrt(4*pi*D*t1))) .* exp(-((x-xo).^2)./(4*D*t));
figure
fsurf(c, [1 10 0 10])
[X,T] = ndgrid(-5:01:5, 0.1:10);
figure
mesh(X, T, c(X,T))
grid on
This runs without error, however it doesn’t plot anything since all the elements of the matrix that ‘c’ produces are NaN.
You need to resolve that problem, so something shows up on the plot. I have no idea what you’re doing, so I can’t help you with that.
See Also
Categories
Find more on 2-D and 3-D Plots 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!