How can I remove some specific terms from a function?
显示 更早的评论
Dear sir, I am trying to write a code that can generate the specific terms from certain function. However, I just cannot find a way to remove the exponential terms. I have a list of functions that generate by same function, that all look like f=a!*sqrt(b+c*i)*exp(-dk+sqrt(b+c*i)), where a,b,c,d are all changing variable. I want to remove all the terms of exp(), so as to use the first two part for next step of calculation. How to do this? Thank you.
To be concrete, here is my formula sheet.
if true
format long;
h=1.05457173e-34;
t=1e25*365*24*3600;
m=60;
a=1/1000;
syms x k;
int(exp(i*k*x-i*h*k^2*t/(2*m)-k^2*a^2/2),k,-Inf,Inf)
f=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/((10126067097211690078125*i)/365375409332725729550921208179070754913983135744+ 1/2000000)^(1/2)
g=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/((158219798393932657470703125*i)/5708990770823839524233143877797980545530986496+1/2000000)^(1/2)
u=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/(27714145064399998094084151567728884845503502656025676347457107551846400*i+ 1/2000000)^(1/2)
o=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/((1756592631284943967788998796645*i)/633825300114114700748351602688+ 1/2000000)^(1/2)
q=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/((89937542721789151668027362145*i)/324518553658426726783156020576256+ 1/2000000)^(1/2)
Z=(real(f))^2;
SD=1/(sqrt(2*pi)*Z)
end
The f g u o q, is some example with different t I done, but actually I need to do for more than 100 times for data analysis. As you see, the integral will generate sth with exp(),and f g u o q are all eliminated by myself.
1 个评论
Walter Roberson
2013-11-11
Are you using the symbolic toolbox? If not then how is your function represented ?
采纳的回答
更多回答(2 个)
Image Analyst
2013-11-11
Does the delete key not work on your computer? Simply delete the term and do this:
f1 = factorial(a)*sqrt(b+c*i);
Why don't you multiply the different part of the equation by different terms e.g Q=1, R=1, S=1, etc and the these terms to zero when you don't want to use the respective part of the equation.
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!