How to find the Fourier coefficients, NEED HELP
조회 수: 143 (최근 30일)
이전 댓글 표시
Hi,
I have the signal:
F(t) = te^(2t), -2 < t < 2 , The Period T = 4.
I have to graph this for, -5 <= t <= 6, which I have the following code for:
clear all
clc
F = @(t) t.*exp(2*t);
T = 4;
t = linspace(-5,6,1000);
S = F(mod(t, T) - T/2 );
plot(t, S);
xlabel('t');
ylable('F(t)');
Now I have make a code to find the Fourier coefficients C0, C1, C2 and C3.
Can anyone Help?
Thank You In advance!!
댓글 수: 2
Paul
2023년 4월 3일
As previously shown in this comment, that equation for S is not correct for turning F(t) into the specified periodic function.
답변 (1개)
Ranjeet
2023년 4월 11일
Hi Sharifi,
Following is the code to get the required coefficients c0, c1, c2 and c4 for the mentioned signal ‘S’.
clear all
clc
syms t;
% Exponential function F
F = @(t) t.*exp(2*t);
% Required time period T
T = 4;
% Periodic function S, created from F
S = F(mod(t, T) - T/2);
fplot(S, [-5, 6]);
xlabel('t');
ylabel('S(t)');
% Uncomment the following code to test with sine and/or cosine signals
% S = sin(t);
% T = 2*pi;
c0 = int(S, -T/2, T/2)/T;
% cn is a 4x1 vector have the required 4 coefficients c0, c1, c2 and c3.
cn = zeros(1,4);
cn(1) = c0;
for n = 1:3
an = int(S*cos(2*pi*n*t/T), -T/2, T/2)*2/T;
bn = int(S*sin(2*pi*n*t/T), -T/2, T/2)*2/T;
cn(n+1) = (an - 1i*bn)/2;
end
cn
Also, you can refer to the following answer related to Fourier Series - https://www.mathworks.com/matlabcentral/answers/66040-calculating-fourier-series-coefficients.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!