MATLAB program: plotting differential equation
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
Steven Lord
2021-11-29
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.
回答(1 个)
Image Analyst
2021-11-29
编辑:Image Analyst
2021-11-29
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 个评论
Image Analyst
2021-11-30
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().
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!