How to calculate equation with multiple variables?

Hello, I am trying to calculate a equation with multiple variables of which some of them depend on another variable like this:
F=A(x)*(x*Ym(beta(x)*rho)+beta2(x)*Jm(beta(x)*rho)*cos(m*phi)*exp(1i*beta3(x)*z)
variables are x, rho, phi, and z, and also there are x dependent quantities like A, beta, beta2, beta3. I am not sure how I can calculate this equation in Matlab since if I use .* for terms such as beta3*z, it will not be right. I am fairly new to Matlab, so only workaround I can think of is to get for loop over x and calculate the equation for each x.
Is there a way I can calculate and generate a multidimensional matrix? Thanks!

2 件のコメント

Chad Greene
Chad Greene 2014 年 10 月 7 日
How many dimensions do you need F to be?
Min
Min 2014 年 10 月 8 日
I think it should be 4 X (x resolution). Currently I am sampling x at 1024, so 4 X 1024 will be the dimension of F.

サインインしてコメントする。

 採用された回答

Mohammad Abouali
Mohammad Abouali 2014 年 10 月 7 日
編集済み: Mohammad Abouali 2014 年 10 月 7 日

0 投票

F=@(x,rho,phi,z) (A(x)*(x*Ym(beta(x)*rho)+beta2(x)*Jm(beta(x)*rho)*cos(m*phi)*exp(1i*beta3(x)*z));
you can define other function that you are using the same way.

1 件のコメント

Min
Min 2014 年 10 月 8 日
Exactly what I wanted. Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

質問済み:

Min
2014 年 10 月 6 日

コメント済み:

Min
2014 年 10 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by