fft - Fourier coefficients using matlab numerical integration -
i have been trying display , bn fourier coefficients in matlab no success, able display a0 because not part of iteration.
i highly appreciate help, below code
syms an; syms n; syms t; y = sym(0); l = 0.0005; inc = 0.00001; % as sample space of 100 points = int(3*t^2*cos(n*pi*t/l),t,-l,l)*(1/l); bn = int(3*t^2*sin(n*pi*t/l),t,-l,l)*(1/l); a0 = int(3*t^2,t,-l,l)*(1/l); a0 = .5 *a0; a0=a0 i=1:5 y = subs(an, n, i)*cos(i*pi*t/0.0005) z = subs(bn, n, i)*sin(i*pi*t/0.0005) end
if stated within question correct, tend solve way:
clc, clear all,close l = 0.0005; n = 5; = zeros(1,n); bn = zeros(1,n); = 1:5 f1 = @(t) 3.*(t.^2).*cos(i.*pi.*t./l); f2 = @(t) 3.*(t.^2).*sin(i.*pi.*t./l); an(i) = quad(f1,-l,l).*(1./l); bn(i) = quad(f2,-l,l).*(1./l); a0 = .5.*quad(@(t) 3.*t.^2,-l,l).*(1./l); end
i hope helps.
fft matlab numerical-integration
No comments:
Post a Comment