I want to know why im getting an error in my code to calculate distance

4 次查看(过去 30 天)
vh = v*sind(theta);
Unrecognized function or variable 'v'.
%for first jump
t0 = (vh + sqrt(vh^2 + 2*ga*h0))/(ga);
s0 = v*t0*cosd(theta);
%for subsequent jumps
t = 2*vh/ga;
s = v*t*cosd(theta);
%no. of jumps
num_hops = floor((xd - s0)/s + 1)

采纳的回答

Cris LaPierre
Cris LaPierre 2023-7-14
You haven't defined the variables you are using in your calculations. Define values for v,theta,ga,h0, & xd and your code will run without producing an error.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by