Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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);

Risposte (1)

Roger Stafford
Roger Stafford il 7 Apr 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));

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by