How can I plot this function that contains integrals?

1 回表示 (過去 30 日間)
Molly McDonough
Molly McDonough 2021 年 3 月 5 日
コメント済み: Star Strider 2021 年 3 月 15 日
I am trying to create the following function in MATLAB to be used for plotting (see image)
Here is the function I have:
function M = diodeMultiplication(alpha, beta, x, w)
M = (exp(-int(alpha-beta,x,w)))./(1-(int(alpha.*exp(-int(alpha-beta,diff(x),w)),0,w));
end
Where x is a constant (I.e. x = 0) and w is a constant (I.e. w = 1.*10^-4) and alpha and beta are arrays of floating point values that are functions of E.
I would like to input alpha,beta, x and w and plot E vs M. which would look something like this:
plot(E, diodeMultiplication(alpha, beta, x, w));
This function will not run. Does anyone have any input? Thank you.

回答 (1 件)

Star Strider
Star Strider 2021 年 3 月 5 日
The problem would appear to be:
M = (exp(-int(alpha-beta,x,x,W))./(1-int(alpha.*exp(-int(alpha-beta, x, x, W)),x,0,W
↑ ↑ ↑ ← HERE
They are not part of any function call. How do you want to apply them?
  2 件のコメント
Molly McDonough
Molly McDonough 2021 年 3 月 15 日
I updated the question to fix errors. Hopefully that helps. Thank you.
Star Strider
Star Strider 2021 年 3 月 15 日
‘... alpha and beta are arrays of floating point values that are functions of E ...’
Having expressions for them is important, since in that situation ‘M’ is then also a function of ‘E’.
Note that using the Sybmolic Math Toolbox (that has the int function) may not be appropriate here, since these integrals may not have analytic solutions, and if int then chooses to use a numeric soluition, would likely be relatively inefficient. It would likely be best to use integral with ‘'ArrayValued',1’, and appropriate expressions for α and β as functions of ‘E’.

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

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by