Evaluating the integral of a function?
Afficher commentaires plus anciens
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
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!