I want to know why im getting an error in my code to calculate distance
4 ビュー (過去 30 日間)
古いコメントを表示
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1433988/image.png)
vh = v*sind(theta);
%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)
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File 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!