I want to evaluate integral of (Hr(w)*cos(n*w*t)-Hi(w)sin(n*w*t))dw with limits 1 to 2 where t=0.2 and T=2000. where Hr(w) is the real part of a function H(w)=10*(((i*w)/0.006)-1)*((-(w^2)/0.64)+(((2*(i*w))/0.8)+1))*(((i*w)/10)-1)*((-(w^2)/2250000)+(((2*(i*w))/1500)+1))/((((w^2)/0.000004)+(((2*(i*w))/0.002)+1))*((-(w^2)/49)+(((2*(i*w))/7)+1))*((-(w^2)/400000000)+(((2*(i*w))/20000)+1))*(((i*w)/100)-1))? And w is a vecor from [0.0005 to 5].
I am trying the following codes but the integral is not happening and instead it shows the error Undefined function 'int' for input arguments of type 'double
w=[0.0005:0.1:5]; n=1:length(w); t=0.1; T=2000;
for j=1:length(w) y(j)=10*(((i*w(j))./0.006)-1)*((-(w(j).^2)./0.64)+(((2*(j.*w(j)))./0.8)+1))*(((j.*w(j))./10)-1)*((-(w(j).^2)./2250000)+(((2*(j.*w(j)))./1500)+1))/((((w(j).^2)./0.000004)+(((2*(j.*w(j)))./0.002)+1))*((-(w(j).^2)./49)+(((2*(j.*w(j)))./7)+1))*((-(w(j).^2)./400000000)+(((2*(j.*w(j)))./20000)+1))*(((j.*w(j))./100)-1)); rr(j)=real(y(j)) ii(j)=imag(y(j)) xc(j)=cos(n(j)*w(j)*t)*rr(j) xs(j)=sin(n(j)*w(j)*t)*ii(j) ad(j)=xc(j)-xs(j) ri(j)=int(ad(j),w,1,2) end
Please help me and even let me know is my method of finding the integral of the function correct?

 Réponse acceptée

Steven Lord
Steven Lord le 18 Août 2015

0 votes

Use INT to integrate an expression written using symbolic variables created using SYM or SYMS from Symbolic Math Toolbox.
Use INTEGRAL to integrate a function whose handle (which could be an anonymous function) you specify as the first input.
Use TRAPZ to integrate a function represented by a set of (X, Y) data.

1 commentaire

ROSHAN SINGH
ROSHAN SINGH le 19 Août 2015
Sir I am trying to evaluate the integral of the same function (Hr(w)*cos(n*w*t)-Hi(w)sin(n*w*t))dw. But this time I am trying to do it in conventional definite integral type.With limits from 0.0005 to 2000 Hz.I am running a loop using for command by varying the values of n? I am using the command int(y,w,0.0005,2000). But error comes wth a message explicit integral cannot be found? Please help me.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by