フィルターのクリア

Help using switch statement

1 回表示 (過去 30 日間)
Steven
Steven 2012 年 4 月 1 日
I need help with a problem involving a switch statement. I need to use switch to write a program that can compute the maximum height of the projectile, the total horizontal distance traveled, or the time to hit. It also asks that it should accept as input v0, A, and g.
I am suppose to test the program with:
v0=40, A=30, g=9.81
I am given height
h(t)=v0*t*sin(A)-0.5g*t^2 (g=gravity)
velocity:
v(t)=sqrt(v0^2-2*v)*t*sin(A)+g^2*t^2

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 4 月 1 日
So then you need user input to indicate which operation to perform, and then you just need to switch on the user input and perform the requested operation. The documentation of switch should make it clear how to use switch in such a basic mode.
  1 件のコメント
Steven
Steven 2012 年 4 月 1 日
I'm confused on what equation I should switch though

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

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by