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

조회 수: 2 (최근 30일)
>> 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.

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 4일
편집: Walter Roberson 2016년 3월 4일
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

추가 답변 (1개)

Joachim Schlosser
Joachim Schlosser 2016년 3월 4일
MATLAB will point you exactly to where it cannot cope with the input. There is a "*" missing in 2(theta0).

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by