How to integrate a symbolic vector?
10 views (last 30 days)
Show older comments
If f=exp(t^2)*cos(t) then i can integrate 'f' using integral command (integral (f,0,1) ), but if 'F' is a vector (having elements similar to 'f' )then how can i integrate it? I am using same command but the answer is symbolic i.e still having 't'. I am not getting how to use trapz command. Your cooperation will be appreciated. Thanks in advance.
Kind Regards Bibigul
0 Comments
Answers (1)
KSSV
on 6 Sep 2017
You should be having the values of t ..substitute those values in the integral expression using subs....convert the result into double using double and then call trapz .
2 Comments
KSSV
on 6 Sep 2017
f{1} = @(t) exp(t.^2).*cos(t)+9*sin(t)+3.*exp(t.^2) ;
f{2} = @(t) cos(t)-sin(t).*exp(t.^2) ;
f{3} = @(t) exp(t.^2) ;
I = zeros(size(f)) ;
for i = 1:length(f)
I(i) = integral(f{i},0,1) ;
end
A = trapz(I) ;
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!