How to define K(r,alpha,beta,z) this function?

function res=K(r,alpha,bta,z)
res=r.^((1-bta)/alpha).*exp(-r.^(1/alpha)).*(r*sin(pi*(1-bta))-...
z*sin(pi*(1-bta+alpha)))/(pi*alpha*(r.^2-2*r*z*cos(pi*alpha)+z.^2));
end
I have to define this K function in other script and have to use it in main program without using "res". Please help.

답변 (1개)

Star Strider
Star Strider 2017년 2월 15일

0 개 추천

I do not understand the problem.
Perhaps an anonymous function will do what you want:
K = @(r,alpha,bta,z) r.^((1-bta)/alpha).*exp(-r.^(1/alpha)).*(r*sin(pi*(1-bta))-z*sin(pi*(1-bta+alpha)))/(pi*alpha*(r.^2-2*r*z*cos(pi*alpha)+z.^2));

댓글 수: 2

Priya Khot
Priya Khot 2017년 2월 15일
I have to call that function in main program twice, once as it is and once by changing the parameters i.e., r,alpha,bta,etc
Put it at the beginning your script and then call it with the appropriate parameters in the appropriate places in your script.
That should work.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

태그

질문:

2017년 2월 15일

댓글:

2017년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by