How do integrate this function over t=0 to t=165?

1 view (last 30 days)
mi=2290000;
mf=130000;
tb=165;
t=linspace(6.5,165);
mr=mi-((mi-mf)*(t/tb))
plot(t,mr, 'blue')
hold all
g = 9.81;
Isp=263;
u=g.*(Isp.*log(mi./mr)-t)

Accepted Answer

Star Strider
Star Strider on 29 Nov 2019
I am not certain what you want to integrate, or what you want the final result to be.
Try this:
mi=2290000;
mf=130000;
tb=165;
t = linspace(0, tb, 150);
mr = mi-((mi-mf)*(t/tb));
mr_int = cumtrapz(t, mr); % Integrate ‘mr’
figure
semilogy(t,mr, 'blue')
hold on
plot(t, mr_int, 'g')
g = 9.81;
Isp=263;
u = g.*(Isp.*log(mi./mr)-t);
u_int = cumtrapz(t, u); % Integrate ‘u’
plot(t, u)
plot(t, u_int)
hold off
legend('mr', 'mr\_int', 'u', 'u\_int', 'Location','SE')
I ploltted the vectors in semilogy so they would all be visible.
Experiment to get different results.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!