Borrar filtros
Borrar filtros

Trying to use quad to solve this integral but keep getting error

1 visualización (últimos 30 días)
Maryam Ansari
Maryam Ansari el 7 de Abr. de 2016
Comentada: Steven Lord el 7 de Abr. de 2016
y = @(x)((1.941-24.3*x).^2)/(2.92*(0.02408-x)*(0.01605-x));
%Using quad to calculate integral
time = quad(y,0,0.01204);
display(time);
This is the error I get
Error in HW7Q2>@(x)((1.941-24.3*x).^2)./(2.92*(0.02408-x)*(0.01605-x))
Error in quad (line 67)
y = f(x, varargin{:});
Error in HW7Q2 (line 4)
time = quad(y,0,0.01204);

Respuestas (1)

Roger Stafford
Roger Stafford el 7 de Abr. de 2016
You've forgotten the dot in your division. It should be:
y = @(x)((1.941-24.3*x).^2)./(2.92*(0.02408-x)*(0.01605-x));
  2 comentarios
Maryam Ansari
Maryam Ansari el 7 de Abr. de 2016
I tried putting the dot but I'm still getting the same error
Steven Lord
Steven Lord el 7 de Abr. de 2016
Add a dot before the last * as well.

Iniciar sesión para comentar.

Categorías

Más información sobre Multidimensional Arrays 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!

Translated by