Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
Maryam Ansari
Maryam Ansari le 7 Avr 2016
Commenté : Steven Lord le 7 Avr 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);

Réponses (1)

Roger Stafford
Roger Stafford le 7 Avr 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 commentaires
Maryam Ansari
Maryam Ansari le 7 Avr 2016
I tried putting the dot but I'm still getting the same error
Steven Lord
Steven Lord le 7 Avr 2016
Add a dot before the last * as well.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by