How come I can't solve this simple equation?

1 vue (au cours des 30 derniers jours)
Maclane Keohane
Maclane Keohane le 17 Sep 2018
Commenté : Maclane Keohane le 17 Sep 2018
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?

Réponse acceptée

Walter Roberson
Walter Roberson le 17 Sep 2018
yq=(v0*sin(q))*((x-x0)/(v0*cos(q)))+(1/2)*g*((x-x0)/(v0*cos(q))).^2+y0;

Plus de réponses (0)

Catégories

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