Need help with matlab code for below mentioned integrals
1 次查看(过去 30 天)
显示 更早的评论
I want to know how to write the code for below two integrals
1.) If
, then how to write the matlab code for
.


2.) If
, then how to write the matlab code for
.


4 个评论
Dyuman Joshi
2023-3-15
conv and trapz only supports numeric data.
Are you sure you have to use trapezoidal rule? You can achieve the result of the integration without using it.
采纳的回答
Dyuman Joshi
2023-3-15
Note that you need symbolic toolbox to run this code -
syms a b x y tau
%Defining functions
r(a,b) = exp(-a-b);
f(a,x) = exp(-0.09*a) + (sin(0.05*x))^2;
K(x) = exp(-x^2)/sqrt(sym(pi));
P = int(r(a,tau)*f(tau,x), tau, 0, 50)
%To calculate the value of the integral for particular values of a and x
%use subs,
P_val = subs(P, [a,x], [1,0])
J = int(K(x-y)*f(a,y), y, 0, 50)
J_val=subs(J, [a,x], [1,0])
For J, int() is unable to compute the value of the definite integral. However, you can get the approximate numerical value by using vpa
J_valapprox=vpa(J_val)
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!