MATLAB program: plotting differential equation

4 views (last 30 days)
Andy.P
Andy.P on 29 Nov 2021
Edited: Andy.P on 1 Dec 2021
Compute the new velocity and acceleration of the aircraft after a change in power level. During a test flight, the test pilot has set the engine power at 50,000 Newtons, which causes the 20,000 Kg aircraft to attend a cruise speed of 250 m/s. The engine throttles are then set to a power level at 80,000 Newtons, and then the aircraft begins to accelerate. The differential equation that determines the acceleration of the aircraft is dv/dt = a(v,t) = T/m - 0.00005v^2
T = thrust level in Newtons (80,000 Newtons)
m = mass in Kg (20,000 Kg)
  1 Comment
Steven Lord
Steven Lord on 29 Nov 2021
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 29 Nov 2021
Edited: Image Analyst on 29 Nov 2021
Here's a start
T1 = 50000; % Initial thrust.
T2 = 80000; % Second thrust.
m = 20000;
v1 = 250; % Initial velocity.
% Note v2 = v1 + a * t, and a(t) = T2/m - 0.00005v(t)^2 (the stated formula)
v2 = v1;
for t = 2 : 40
a = T2/m - 0.00005 * v2(t-1)^2;
v2(t) = v2(t-1) + a * t;
end
plot(v2, 'b-', 'LineWidth', 2)
grid on;
xlabel('Time')
ylabel('Velocity')
  2 Comments
Andy.P
Andy.P on 30 Nov 2021
Edited: Andy.P on 30 Nov 2021
Great and how come you did * v2 ( t -1 ) ^ 2. Why t - 1 ?
Also do you integrate dv/dt ?
Image Analyst
Image Analyst on 30 Nov 2021
Let's say that you have the last (past) time point, and you have a (future/next) time point that you want to compute. The acceleration cannot depend on the next velocity value -- you don't know that velocity yet! So you have to compute the acceleration based on the only velocity you know, which is the last velocity.
I didn't do any integration or differentiation. It was just strictly digital algebra. If you want/need to integrate some curve you can use trapz(), sum(), or maybe integrate().

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!