Numerical integration for a vector.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Can anybody help me with this? I do have problems to be integrating, when z is also defined as a vector, so I can't be using syms.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/966800/image.png)
5 comentarios
Star Strider
el 17 de Abr. de 2022
Try either of these, after supplying
,
, and t —
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/966820/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/966825/image.png)
z = ...;
d = numel(z)/2;
n = linspace(0, 1E4, 2*d);
ftrpz = (ui,cv,t,z) trapz(ui.*sin(pi*n.*z/(2*d))) .* sin(pi*n.*z/(2*d)) .* exp(-n.^2.*pi^2.*cv.*t/(4*d^2));
fintg = (ui,cv,t,z) integral(@(z)ui.*sin(pi*n.*z/(2*d)), 0, inf, 'ArrayValued',1) .* sin(pi*n.*z/(2*d)) .* exp(-n.^2.*pi^2.*cv.*t/(4*d^2))
See the documentation on trapz and integral for details. Then decide which version of ‘f’ works best in your application. Use the sum function complete the expression.
I cannot test this, so I am posting it as UNTESTED CODE. It will be necessary to experiment with it with your data to produce the desired result. The
variable does not appear anywhere, so I have no idea what to do with it.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/966830/image.png)
There is not enough information to proceed further.
Respuestas (0)
Ver también
Categorías
Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!