Evaluating the integral of a function?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ROSHAN SINGH
am 18 Aug. 2015
Kommentiert: ROSHAN SINGH
am 19 Aug. 2015
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?
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 18 Aug. 2015
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!