How to plot a function containing an integral?
Mostrar comentarios más antiguos
Hello all! I've got very simple code:
function y=sc()
a=2;
x=linspace(0,100);
fun1 =quadgk(@(m) m.*a .*x, 0, 2);
y = plot(x,fun1);
end
In the specific case above the value of the integral =2, and also a=2, so one could expect the linear plot as a result o function sc. Instead there is an error: error using .*, matrix dimensions must agree. The fun1 gives exact values, when user provides a and x values. Is there a simple way to create a plot(x,fun1) without making any loops?
2 comentarios
Star Strider
el 31 de Mzo. de 2016
What is ‘fun2’?
Pawel Rochowski
el 31 de Mzo. de 2016
Editada: Pawel Rochowski
el 31 de Mzo. de 2016
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!