How come I can't solve this simple equation?

5 ビュー (過去 30 日間)
Maclane Keohane
Maclane Keohane 2018 年 9 月 17 日
コメント済み: Maclane Keohane 2018 年 9 月 17 日
g=9.81;
x0=-1000;
y0=1;
v0=585;
q=10;
w=12;
e=14;
x=0:100:4029.7;
%From the Projectile Motion Equations, I substituted the t value of the x
%component into the y compnonent function. This way I have a graph of
%height(y) as a function of distance(x). Here are the different artillery angle shot
%functions.
yq=(v0*sin(q))*((x-x0)/(v0*cos(q)))+(1/2)*g*((x-x0)/(v0*cos(q)))^2+y0;
%I receive the error:
Error using ^
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is
a scalar. To perform elementwise matrix powers, use '.^'.
Error in MacLab2 (line 24)
yq=(v0*sin(q))*((x-x0)/(v0*cos(q)))+(1/2)*g*((x-x0)/(v0*cos(q)))^2+y0;
%How can I write this code for it to function?

採用された回答

Walter Roberson
Walter Roberson 2018 年 9 月 17 日
yq=(v0*sin(q))*((x-x0)/(v0*cos(q)))+(1/2)*g*((x-x0)/(v0*cos(q))).^2+y0;
  1 件のコメント
Maclane Keohane
Maclane Keohane 2018 年 9 月 17 日
You are the man Walter!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by