Modelling a finite potential well
이전 댓글 표시
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
Andrew Newell
2011년 5월 30일
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?
답변 (1개)
Walter Roberson
2011년 5월 30일
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.
카테고리
도움말 센터 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!