vertical throw in matlab?

4 Ansichten (letzte 30 Tage)
Isak N.
Isak N. am 13 Apr. 2020
Beantwortet: Mehmed Saad am 14 Apr. 2020
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 Kommentare
KALYAN ACHARJYA
KALYAN ACHARJYA am 13 Apr. 2020
Isak N.
Isak N. am 13 Apr. 2020
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).

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Image Analyst
Image Analyst am 13 Apr. 2020
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 am 14 Apr. 2020
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)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by