How to find the Fourier coefficients, NEED HELP
150 次查看(过去 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!