Greetings to all, could you help me with this integral please

Greetings dear friends, I am trying to graph this integral so that I can obtain a graph x =f(t)
Thank you!

4 件のコメント

Torsten
Torsten 2022 年 2 月 17 日
Not clear what you mean.
The integral will be a function of t and x: I = F(x,t).
Now what do you want to plot ?
Lewis HC
Lewis HC 2022 年 2 月 17 日
I need to plot that function, dear friend
John D'Errico
John D'Errico 2022 年 2 月 17 日
編集済み: John D'Errico 2022 年 2 月 17 日
Plot as a function of WHAT? What will be plotted on each axis? Since you want to integrate over w, that still leaves TWO variables, x and t. And while you seem to think you can plot x on the x axis, and t on the y axis, that makes no sense, since you are asking to plot the INTEGRAL. x = f(t) makes no sense in this context, because there is no functional relationship there, not even an implicit one.
Worse, since there is a complex component in this, what will you plot assuming the result is complex? The real or the imaginary part? And how does the integral factor in?
Lewis HC
Lewis HC 2022 年 2 月 17 日
I want to do something similar to what you can see from minute 5 of this video:
Thank you dear John

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

 採用された回答

Torsten
Torsten 2022 年 2 月 17 日
編集済み: Torsten 2022 年 2 月 17 日

1 投票

t = linspace(0.1,3,29);
x = linspace(-3,3,60);
[T,X] = meshgrid(t,x)
for i = 1:numel(x)
for j = 1:numel(t)
f = @(w) 1/pi*sin(w)./w.*exp(-T(i,j)*w.^2).*cos(w.*X(i,j));
I = integral(f,-Inf,Inf);
F(i,j) = I;
end
end
surf(T,X,F)
You only need to consider the real part of the integrand since the imaginary part is an odd function of w, thus with integral = 0.

4 件のコメント

Lewis HC
Lewis HC 2022 年 2 月 17 日
Thank you very much dear friend, I am trying to enter the code but I get an error
Torsten
Torsten 2022 年 2 月 17 日
What's the error you get ?
David Goodmanson
David Goodmanson 2022 年 2 月 17 日
Hi Luis,
or you could replace the for loops with
F = (1/2)*( erf((X+1)./(2*sqrt(T))) -erf((X-1)./(2*sqrt(T))) );
and get the same result.
Lewis HC
Lewis HC 2022 年 2 月 18 日
Greetings to all, thank you very much for the support provided dear friends, you helped me with my problem in the most precise way, you are the best, thank you!

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2022 年 2 月 17 日

コメント済み:

2022 年 2 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by