필터 지우기
필터 지우기

serie fourier using matlab

조회 수: 1 (최근 30일)
nour yousfi
nour yousfi 2017년 10월 15일
편집: nour yousfi 2017년 10월 16일
hi; I want a fourier transform of a piecewise function using matlab . The function is defined as follows:
0.6+t/0.3*pi when 0 <t < 0.12*pi
1 when 0.12*pi <t < 1.08*pi
4.6-t/0.3*pi when 1.08*pi <t < 1.2*pi
0.6 when 1.2*pi <t <2*pi
any help will be appreciated
I tried to do that but I didn't found a good result
Matlab file: clear all syms t n T1=2*pi;
I1 = int((0.6+(t/0.3*pi)), t,0,0.12*pi); I2 = int(1, t,0.12*pi,1.08*pi); I3 = int((4.6-(t/0.3*pi)), t,1.08*pi,1.2*pi); I4 = int(0.6, t,1.2*pi,2*pi);
a0 = (1/T1)*(I1 + I2 + I3+I4); fourierSum = 0;
II1 = int((0.6+(t./0.3*pi))*cos((2*n*pi*t)/T1), t,0,0.12*pi); II2 = int((1)*cos((2*n*pi*t)/T1), t,0.12*pi,1.08*pi); II3 = int((4.6-(t./0.3*pi))*cos((2*n*pi*t)/T1), t,1.08*pi,1.2*pi); II4 = int((0.6)*cos((2*n*pi*t)/T1), t,1.2*pi,2*pi); III1 = int((0.6+(t./0.3*pi))*sin((2*n*pi*t)/T1), t,0,0.12*pi); III2 = int(sin((2*n*pi*t)/T1), t,0.12*pi,1.08*pi); III3 = int((4.6-(t./0.3*pi))*sin((2*n*pi*t)/T1), t,1.08*pi,1.2*pi); III4 = int((0.6)*sin((2*n*pi*t)/T1), t,1.2*pi,2*pi);
for k = 1:40 an = subs(II1 + II2 + II3+II4,n,k); bn = subs(III1 +III2+III3+III4,n,k); term = an*cos((2*k*pi*t)/T1); termm = bn*sin((2*k*pi*t)/T1); fourierSum = fourierSum+term+termm; fourierSum=(2/T1)*fourierSum; end
ezplot(vpa(a0+fourierSum,6), [0 10])
  댓글 수: 1
Karan Gill
Karan Gill 2017년 10월 16일
Please format your question and code.

댓글을 달려면 로그인하십시오.

답변 (1개)

nour yousfi
nour yousfi 2017년 10월 15일
편집: nour yousfi 2017년 10월 15일
the result must be as it shown in the following picture

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by