where is the mistake?

조회 수: 3 (최근 30일)
Julia
Julia 2012년 11월 5일
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.

채택된 답변

Thomas
Thomas 2012년 11월 5일
You missed the * after 2 in the last terms
use
throwfun = @(x) x.*tan(a)-((g*x.^2)/(2*(v*cos(a))^2));
  댓글 수: 1
Julia
Julia 2012년 11월 5일
THANKS!!!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by