필터 지우기
필터 지우기

How can I enter this integral?

조회 수: 1 (최근 30일)
sharif
sharif 2014년 3월 14일
댓글: Walter Roberson 2014년 3월 16일
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