ans = 
How can I solve the problem in integral code?
12 Mayo 2025
1 Respuesta
6 Visualizaciones (30 días)
Ahora está siguiendo esta pregunta
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
Mostrar comentarios más antiguos
0 votos
Comparte un enlace a esta pregunta
Solve the problem
Respuesta aceptada
1 voto
Comparte un enlace a esta respuesta
Loop over the values of the sigma-vector - thus call "vpaintegral" for each sigma value separately.
Or alternatively make your code a function and call it from a script with a single sigma-value as input.
Further, I'd recommend first to use "integral" instead of "vpaintegral" to save computation time.
And where do you compute w1 - w6 - the variables you try to plot at the end of your code ?
Works because "vpaintegral" is called for each sigma-value separately:
syms r
f = r^2;
sigma = 0:0.1:1;
arrayfun(@(sigma)vpaintegral(f,r,0,sigma),sigma)
Does not work because "vpaintegral" is called once with the complete sigma-vector:
syms r
f = r^2;
sigma = 0:0.1:1;
vpaintegral(f,r,0,sigma)
Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical scalar values.
Error in sym/vpaintegral (line 182)
(isinf(b) && isempty(symvar(b)) && ~isreal(b))
8 comentarios
Shreen El-Sapa
el 12 de Mayo de 2025
Comparte un enlace a este comentario
Torsten
el 12 de Mayo de 2025
Comparte un enlace a este comentario
It's the same problem as above. "vpaintegral" can integrate one function over one interval of integration at a time. Thus alpha must be a single value when you call "vpaintegral", not a vector of values.
Shreen El-Sapa
el 12 de Mayo de 2025
Comparte un enlace a este comentario
Thanks I will try to use it.
Shreen El-Sapa
el 12 de Mayo de 2025
Comparte un enlace a este comentario
Excuse me, Can I do this for 6 integrals?
Shreen El-Sapa
el 12 de Mayo de 2025
Movida: Torsten
el 12 de Mayo de 2025
Comparte un enlace a este comentario
please see this:
Torsten
el 12 de Mayo de 2025
Comparte un enlace a este comentario
Try the attached revised code.
Walter Roberson
el 12 de Mayo de 2025
Comparte un enlace a este comentario
Note that vpaintegral() can handle the case where the part to be integrated is non-scalar, but cannot handle the case where the limits to integration are non-scalar.
syms x
vpaintegral([sin(x), cos(x)], x, [0 1])
ans = 
Comparte un enlace a este comentario
Thank you for the info.
So the changes to your last code (test_microstrength.m) were not necessary (except for the final plotting).
Más respuestas (0)
Categorías
Más información sobre Calculus en Centro de ayuda y File Exchange.
Ver también
el 12 de Mayo de 2025
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
