Modelling a finite potential well
Afficher commentaires plus anciens
I have to model a finite potential well of the form: V(r)=-Vo for 0<r<a (a:constant) and 0 ,for r>a I am using an anonymous function of the form
f=@(r)(<some expression in r>.*sin((k)*r);
'k' is another constant.
The trouble is, that 'some expression in r' should be an explicit mathematical relation,because I would be using the fuction f in a subsequent integration expression ,integrating f wrt r from r=0 to a large value (for infinity).Any ideas as to how can I specify such a potential in f ? Thanks in advance.
1 commentaire
Andrew Newell
le 30 Mai 2011
It is not clear what you mean by "model". Why is there a sin(k*r) in your anonymous function? Is "some expression" supposed to be the potential?
Réponses (1)
Walter Roberson
le 30 Mai 2011
I am confused by the difference between "an explicit mathematical relation" compared to a MATLAB expression, but I suspect what you mean is that f(r) must return an expression rather than a value, such as you could implement if you were to use the symbolic toolkit and a symbolic expression.
It is possible for an anonymous function to return an anonymous function. For example,
f = @(x) @(r) x.^2/r;
g = f(3);
g(7)
which would return 3^2/7. x would still show up as a variable in the display of g, but its value would have been captured none-the-less.
Catégories
En savoir plus sur Assumptions dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!