How can I enter this integral?

1 次查看(过去 30 天)
hm=1.5;
t= 0:-0.1:-1;
m=100;
n=1:1:m;
Fs=zeros(length(t),length(n));
FEM=zeros(length(t),length(n));
for ii=1:length(t)
for jj = 1:length(n);
Lm=76.3-10*log10(hm);
x=(-1j*t(ii)*sqrt(m-n)*sqrt(2/pi)+0.5);
y=(exp(-t*srt(n-m)))/(sqrt(2j));
S=int(sin(y),y=0..x);% how can I use this integration??
C=int(cos(y),y=0..x);
Fs(x)=y(S+1j*C);
FEM(ii,jj)= (1/n)*sum(Lm(t(ii))*Fs);
end
end

采纳的回答

Walter Roberson
Walter Roberson 2014-3-14
int() is used only for symbolic integration. You use integral() or older equivalents for numeric integration. integral() should be passed a function handle.
For example, to numerically integrate sin(t) over 0 to 2, one could use
integral(@(t) sin(t), 0, 2)
In your code you have a series of problems caused by using vectors. Your "n" is a vector, so sqrt(m-n) is going to be a vector so your x is going to be a vector and your y is going to be a vector. Then you try to integrate the vector sin(y) over y from 0 to x, but x is a vector and y has already been defined through a formula.
With you trying to use y as a variable of integration when y is defined by a formula, are you implicitly wanting to solve for the "t" such that the expression for y at that value of t gives you each value from 0 to x ?
If you have a fixed numeric vector of values, you would use trapz() or a similar integral approximation routine.
  4 个评论
sharif
sharif 2014-3-15
matlab 10 is the one i am using, I will first try to solve the integral problem and then I will try to solve the others, thanks for help
Walter Roberson
Walter Roberson 2014-3-16
I believe integral() was introduced in R2011-something. Before that see quad() or quadgk()

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by