MATLAB Answers

0

plot to find root Error: Unbalanced or unexpected parenthesis or bracket

Asked by Ahzabuddin on 4 Mar 2016
Latest activity Edited by Walter Roberson
on 4 Mar 2016
>> v0 = 20; x = 35; y0 = 2; y = 1; g = 9.81;
theta0 = linspace(0,90);
ftheta0 = tan(theta0)*x-(g/(2*v0^2*cos^2(theta0))*x^2)+y0-y;
??? ftheta0=tan(theta0)*x-(g/(2*v0^2*cos^2(theta0))*x^2)+y0-y;
|
Error: Unbalanced or unexpected parenthesis or
bracket.

  0 Comments

Sign in to comment.

2 Answers

Answer by Joachim Schlosser on 4 Mar 2016

MATLAB will point you exactly to where it cannot cope with the input. There is a "*" missing in 2(theta0).

  0 Comments

Sign in to comment.


Answer by Walter Roberson
on 4 Mar 2016
Edited by Walter Roberson
on 4 Mar 2016

MATLAB does not support the syntax cos^2(theta0) to mean the square of the cos of theta0. You need to use cos(theta0).^2

  0 Comments

Sign in to comment.