필터 지우기
필터 지우기

How to find the Fourier coefficients, NEED HELP

조회 수: 60 (최근 30일)
Mohammad Sharifi
Mohammad Sharifi 2023년 4월 3일
답변: Ranjeet 2023년 4월 11일
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
Torsten
Torsten 2023년 4월 3일
Use the definition of the Fourier coefficients and MATLAB's "integral".
Paul
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
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
cn =
10.2429 + 0.0000i 7.9449 + 4.5829i 4.3542 + 5.2942i 2.4458 + 4.5360i
Also, you can refer to the following answer related to Fourier Series - https://www.mathworks.com/matlabcentral/answers/66040-calculating-fourier-series-coefficients.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by