plot the probability distribution from Schrodinger Equation
Show older comments
Hi everyone,
I have been trying t plot this probability of a function in 3D space with the following coding, but it always gives a blank plot. I'll appriciate your help.
The function is:
f(x,y,z) = 8*sqrt(sin(k*x)*sin(k*y)*sin(k*z)) on the interval: 0<x<1, 0<y<1, and 0<z<1. Note that k = n*pi/a, in this case a =1 and n = 1.
>> n=1; a=1;
>> x = linspace(0,0.01,1);
>> y = linspace(0,0.01,1);
>> z = linspace(0,0.01,1);
>> [X,Y,Z] = meshgrid(x,y,z);
>> f = 8.*sqrt(sin(n*pi*x/a).*sin(n*pi*y/a).*sin(n*pi*z/a));
>> figure
>> scatter3(f,X,Y,Z)
Accepted Answer
More Answers (1)
Paul
on 10 Oct 2021
0 votes
scatter3() is used to plot points in 3D space. But f is really a function of three variables, so you'll need an alternative to visualize f. Check the doc page for visualizing volume data.
Categories
Find more on Scatter 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!
