Borrar filtros
Borrar filtros

How can I enter this integral?

1 visualización (últimos 30 días)
sharif
sharif el 14 de Mzo. de 2014
Comentada: Walter Roberson el 16 de Mzo. de 2014
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Mzo. de 2014
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 comentarios
sharif
sharif el 15 de Mzo. de 2014
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 el 16 de Mzo. de 2014
I believe integral() was introduced in R2011-something. Before that see quad() or quadgk()

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by