vertical throw in matlab?

7 ビュー (過去 30 日間)
Isak N.
Isak N. 2020 年 4 月 13 日
回答済み: Mehmed Saad 2020 年 4 月 14 日
So I have the following situation: Phase one: something is being accelerated using a spring with a certain lenght, hence gaining a certain velocity. Phase two: vertical throw with said starting velocity. My question: how am i able to plot these two phases (acc., velocity and position) in one graph? If I'd go with the classical approach learned in physics class I'd end up with two different equations for phase one and two, so how can i combine them? don't know if this makes sense since i am an absolute beginner at matlab. I tried plotting both phases separately but that kind of defeats its purpose. any tips?
  5 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 4 月 13 日
Isak N.
Isak N. 2020 年 4 月 13 日
like the first one! I'd like to have the time on the x-axis and the other quantities on the y-axis. But the thing i am struggling with is fitting two different equations for, lets say for instance: the position, into one graph. equation 1 is for phase one (t=0 until the time the spring stops accelerating my object) and equation 2 is for phase two (t=time the spring stops accelerating my object until t=object lands).

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

回答 (2 件)

Image Analyst
Image Analyst 2020 年 4 月 13 日
I'd use three plots, all plotted with time as the x axis. Why? Because they could all have vastly different ranges! Let's say you dropped something from an airplane. The distance plot could range from 0 to 40,000 feet while the acceleration would be a constant 9.8 m/s^2. And velocity could be from 0 to 195 km/hour. So plotting the acceleration on the same plot as the position would make the acceleration plot virtually unnoticeable and the velocity barely noticeable. Of course you could do it if you want:
plot(t, acc, '-'); % Plot acceleration vs. time.
hold on;
plot(t, velocity, '-');
plot(t, position, '-');
legend('Acceleration', 'Velocity', 'Position');
grid on;
xlabel('Time', 'FontSize', 15);
ylabel('Accel, Velocity, or Position', 'FontSize', 15);

Mehmed Saad
Mehmed Saad 2020 年 4 月 14 日
Define three different times for acceleration, velocity and position if there time is different (remember that each time vector size must be equal to corresponding accelaration vector, velocity vector and position vector)
t_acc = starting_acc_point:sampling_time:ending_acc_point;
t_vel = starting_vel_point:sampling_time:ending_vel_point;
t_pos = starting_pos_point:sampling_time:ending_pos_point;
Now plot them
figure,plot(t_acc,acc),hold on,plot(t_vel,vel),hold on,plot(t_pos,pos)

カテゴリ

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