How to Plot an Integral
14 ビュー (過去 30 日間)
古いコメントを表示
Find the solution to the initial value problem x′ = e^(−t)/√t, x(1) = 0, in terms of an integral with a variable upper limit. Plot the solution on the interval [1, 4] using a computer algebra system.
s=.01:0.1:5;
x=exp(-s)/sqrt(s);
vals=cumtrapz(s,x);
t=s;
plot(t,vals)
This what I've tried, but it's not working.
0 件のコメント
回答 (1 件)
Star Strider
2017 年 2 月 1 日
Try this:
x = @(s) exp(-s)/sqrt(s);
upper_limit = linspace(1, 4);
xval = arrayfun(@(uplim) integral(x, 0, uplim, 'ArrayValued',true), upper_limit);
figure(1)
plot(upper_limit, xval)
grid
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!