Graphing

4 ビュー (過去 30 日間)
Kyle Taliaferro
Kyle Taliaferro 2011 年 8 月 31 日
So i have the equations of
%Vehicle 1 V1f = (M1*V1 + M2*V2 + M2*E*(V2-0)) / (M1 +M2);
%Vehicle 2 V2f = (M1*V1 + M2*V2 + M1*E*(V1-V2)) / (M1 +M2);
%Time Traveled
T1=(M1*V1f) / (U*M1*G);
T2= (M2*V2f) / (U*M2*G);
%Distance traveled after the Collision
%Vehicle 1
s1 = (V1f*T1) -(.5*U*G*T1^2);
%Vehicle 2
s2 = (V2f*T2) -(.5*U*G*T2^2);;
I need to have a line graph comparing S1 vs T1 and S2 vs T2. How would i create a line graph of these.

採用された回答

Walter Roberson
Walter Roberson 2011 年 8 月 31 日
plot(T1, s1, 'r', T2, s2, 'g')
This presumes that T1 and T2 are each vectors of times after their calculation. But if so, if they are vectors, then you probably need to change your s equations slightly:
%Distance traveled after the Collision
%Vehicle 1
s1 = (V1f.*T1) -(.5*U*G*T1.^2);
%Vehicle 2
s2 = (V2f.*T2) -(.5*U*G*T2.^2);
  5 件のコメント
Walter Roberson
Walter Roberson 2011 年 8 月 31 日
Like,
t1n = linspace(0,T1,200);
s1n = (V1f.*t1n) -(.5*U*G*t1n.^2);
plot(t1n, s1n)
Kyle Taliaferro
Kyle Taliaferro 2011 年 8 月 31 日
Yes. Thankyou. That did the trick.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by