フィルターのクリア

Plotting a two dimensional equation with an integral

2 ビュー (過去 30 日間)
Danisaurus
Danisaurus 2021 年 1 月 22 日
コメント済み: Alan Stevens 2021 年 1 月 22 日
Hi!
I would like to plot the function
For different values of K. How do I do this?
Thanks in advance
  2 件のコメント
Tayyab Khalil
Tayyab Khalil 2021 年 1 月 22 日
This is what i have come up with, i have taen out the k in the exponent out of the integration as well because for some reason that wasn't working inside, shouldn't have any effect on the end result really. And i assumed that you are working with a fixed value of r.
r = 10; k = -3:0.1:3;
fun = @(x) cos(x).^2.*exp(-0.5*(r*sin(x)).^2)/sqrt(2*pi);
I = k.*exp(-k.^2).*integral(fun, -pi/2, pi/2)
plot(k, I);
Alan Stevens
Alan Stevens 2021 年 1 月 22 日
@Tayyab: Note that
exp(-k.^2).*exp(-0.5*(r*sin(x)).^2) = exp(-k.^2-0.5*(r*sin(x)).^2)
not
exp(-0.5*(k*r*sin(x)).^2)

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

採用された回答

Alan Stevens
Alan Stevens 2021 年 1 月 22 日
Something like this
K = 1:10; % or whatever values you want
for i = 1:numel(K)
I(i) = integral(@(theta) Ifn(theta,K(i)),-pi/2,pi/2);
end
plot(K,I),grid
function kern = Ifn(theta,K)
r = 2; % replace with true value
kern = cos(theta).^2.*exp(-(K*r*sin(theta)).^2/2)/(2*pi);
end

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by