Greetings dear friends, I am trying to graph this integral so that I can obtain a graph x =f(t), thanks for your help!

I need to get this curve in my 3D graph:
My code which I was working is this:
Thank you dear friends!

4 件のコメント

Torsten
Torsten 2022 年 2 月 25 日
編集済み: Torsten 2022 年 2 月 25 日
Correction to your f:
f = @(p) 1/(pi*sqrt(2*pi)) ...
instead of
f = @(p) 1/pi*sqrt(2*pi) ...
Correction for your tspan:
The integral does not exist for t<=0
And what is plotted against what in your graph ?
Lewis HC
Lewis HC 2022 年 2 月 25 日
Dear Torsten
I need to obtain this graph dear friend:
Paul
Paul 2022 年 2 月 26 日
How does exp(i*p*x) in the equation become just cos(p*x) in the code? Unless of course only the real part of the integral is goal.
Torsten
Torsten 2022 年 2 月 26 日
The imaginary part of the function is odd in p - so the integral is 0.

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

 採用された回答

Voss
Voss 2022 年 2 月 25 日
編集済み: Voss 2022 年 2 月 25 日
Note that t > 0 and the grids on the surface in the desired image are more widely spaced than the actual points where the surface has been calculated (i.e., there is curvature in between grid lines).
t = linspace(0.0001,2,50);
x = linspace(-2,2,50);
[T,X] = meshgrid(t,x);
for i = 1:numel(x)
for j = 1:numel(t)
% f = @(p)1/pi*sqrt(2*pi)*sin(p)./p.*exp(-T(i,j).*p.^2).*cos(p.*X(i,j));
f = @(p)1/(pi*sqrt(2*pi))*sin(p)./p.*exp(-T(i,j).*p.^2).*cos(p.*X(i,j));
F(i,j) = integral(f,-Inf,Inf);
end
end
surf(T,X,F);
colormap(flip(autumn()));
xlabel('t');
ylabel('x');
zlabel('u(x,t)');

2 件のコメント

f = @(p)1/(pi*sqrt(2*pi))*sin(p)./p.*exp(-T(i,j).*p.^2).*cos(p.*X(i,j));
instead of
f = @(p)1/pi*sqrt(2*pi)*sin(p)./p.*exp(-T(i,j).*p.^2).*cos(p.*X(i,j));
Voss
Voss 2022 年 2 月 25 日
Oh yeah! Thanks!
I saw your comment before, but then I just typed in the code from the screenshot in the question anyway. D'oh!

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

その他の回答 (1 件)

Lewis HC
Lewis HC 2022 年 3 月 1 日
I really don't know what I would do without your great help, thank you very much dear friends, you are the best!

カテゴリ

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

質問済み:

2022 年 2 月 25 日

回答済み:

2022 年 3 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by