Modelling a finite potential well
Mostra commenti meno recenti
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 Commento
Andrew Newell
il 30 Mag 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?
Risposte (1)
Walter Roberson
il 30 Mag 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.
Categorie
Scopri di più su Assumptions in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!