Greetings dear friends, I am trying to graph this integral so that I can obtain a graph x =f(t), thanks for your help!
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Lewis HC
el 25 de Feb. de 2022
Respondida: Lewis HC
el 1 de Mzo. de 2022
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/906965/image.png)
I need to get this curve in my 3D graph:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/906970/image.png)
My code which I was working is this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/906975/image.png)
Thank you dear friends!
Respuesta aceptada
Voss
el 25 de Feb. de 2022
Editada: Voss
el 25 de Feb. de 2022
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 comentarios
Torsten
el 25 de Feb. de 2022
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
el 25 de Feb. de 2022
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!
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!