How to find the Fourier coefficients, NEED HELP

23 visualizzazioni (ultimi 30 giorni)
Mohammad Sharifi
Mohammad Sharifi il 3 Apr 2023
Risposto: Ranjeet il 11 Apr 2023
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 Commenti
Torsten
Torsten il 3 Apr 2023
Use the definition of the Fourier coefficients and MATLAB's "integral".
Paul
Paul il 3 Apr 2023
As previously shown in this comment, that equation for S is not correct for turning F(t) into the specified periodic function.

Accedi per commentare.

Risposte (1)

Ranjeet
Ranjeet il 11 Apr 2023
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.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by