Effacer les filtres
Effacer les filtres

where is the mistake?

2 vues (au cours des 30 derniers jours)
Julia
Julia le 5 Nov 2012
I'm trying to get this anonymous function to work bur no matter how I do it it keeps telling me that there is something wrong with the parenthesis or brackets. What can I do to fix this?
a=45; g=9.82; v=9.0;
>> throwfun = @(x) x.*tan(a)-((g*x.^2)/(2(v*cos(a))^2));
Error: Unbalanced or unexpected parenthesis or bracket.

Réponse acceptée

Thomas
Thomas le 5 Nov 2012
You missed the * after 2 in the last terms
use
throwfun = @(x) x.*tan(a)-((g*x.^2)/(2*(v*cos(a))^2));
  1 commentaire
Julia
Julia le 5 Nov 2012
THANKS!!!!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numeric Types 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