i have general question fourier series:
assume f , g 2 functions related each other nonlinearly, example f can obtained if g known; , assume can calculate f in terms of g , fourier expansion of both f , g below.
f = a1*cos(w*t)+b1*sin(w*t)+a3*cos(3*w*t)+b3*sin(3*w*t); g = c1*cos(w*t)+d1*sin(w*t)+c3*cos(3*w*t)+d3*sin(3*w*t);
my question how can apply phase shift (phi) f numerically in matlab , how can find phase shift in g since f , g related? appreciate if can explain on example.
thank time.
i found example helpful understand, answers question.
i found online can not find now. once post link here. hope others too, here is:
m = 11 ; n_time = (2^m); w_1 = 0.0307; t = 2*pi/w_1 ; dt = t/2^m; ffreq = 2*pi/t ; % fundamental frequency t = linspace(0,t,n_time+1) ; f = []; tk=t if tk<20 x = 5 ; f = [f,x] ; elseif tk<80 x = tk/4*cos(2*pi*tk/20); f = [f,x] ; else x = -tk/10+28 ; f = [f,x] ; end end fhat = f ; fhat(1) = (f(1)+f(n_time+1))/2 ; fhat(n_time+1) = [] ; f = fft(fhat,n_time) ; f_0 = f; f=f(1:n_time/2) ; k=0:(n_time/2-1) ; omega=k*ffreq ; % rads/sec = 2*real(f)/n_time ; a(1)= a(1)/2 ; b =-2*imag(f)/n_time ; figure; plot(t, f,'b'); hold on; plot(t(2:end), real(ifft(f_0)),'--r'); l = 30 ; fapprox = a(1)*ones(size(t)); k=1:l fapprox = fapprox + a(k+1)*cos(omega(k+1)*t)... + b(k+1)*sin(omega(k+1)*t); end figure; plot(t, f,'-b','linewidth',2); hold on; axis tight; plot(t, fapprox,'--r','linewidth',2);
Comments
Post a Comment