Borrar filtros
Borrar filtros

Trouble with using plot because of wrong data type

1 visualización (últimos 30 días)
Minh Hoang
Minh Hoang el 7 de Mzo. de 2024
Respondida: Mathieu NOE el 7 de Mzo. de 2024
I am trying to plot the hydrogen radial probability by just simply using plot and inserting manually the wave function. Here is my code:
syms r
a0 = 0.529177 * 10^(-10); %Bohr radius
R = 2*(1/2*a0)^(3/2)*exp(-r/a0); %wave function for n = 1, l = 0
line = (r^2)*(R^2); %corresponding radial probability
plot(r/a0,line) %I am trying to scale the plot in units of Bohr radius 𝑎0
Error using plot
Data must be numeric, datetime, duration, categorical, or an array convertible to double.
However, the system tells me that my data is not one of the types that can be used in plot. Could anyone help me point out how to fix this? Thanks a lot!

Respuesta aceptada

Mathieu NOE
Mathieu NOE el 7 de Mzo. de 2024
A numerical simulation (no sym)
a0 = 0.529177 * 10^(-10); %Bohr radius
r = linspace(0,10*a0,100);
R = 2*(1/2*a0)^(3/2)*exp(-r/a0); %wave function for n = 1, l = 0
line = (r.^2).*(R.^2); %corresponding radial probability
plot(r/a0,line) %I am trying to scale the plot in units of Bohr radius 𝑎0

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by