(Solved) : Created Code Order Calculate Sketch Fourier Coefficients A0 Bn Without Using Fourier Serie Q26192480 . . .
I have created this code in order to calculate and sketch theFourier Coefficients A0 ,An ,and Bn without using Fourier Seriescommand but,unfortunately the plots results did not look like aFourier Series. if someone please guide me to solve thisproblem.
*the time that I want to calculate my funaction from 0:0.1:1
thank you
I identified all the terms that i am going to use in thisproject
T=1; %Time Period wo=2*pi/T;a0=0;% coefficient A0=0;% coefficienta1=0;% coefficientA1=0;% coefficienta2=0;% coefficientA2=0;% coefficienta3=0;% coefficientA3=0;% coefficienta4=0;% coefficientA4=0;% coefficienta5=0;% coefficientA5=0;% coefficienta6=0;% coefficientA6=0;% coefficienta7=0;% coefficientB7=0;% coefficientb1=0;% coefficientB1=0;% coefficientb2=0;% coefficientB2=0;% coefficientb3=0;% coefficientB3=0;% coefficientb4=0;% coefficientB4=0;% coefficientb5=0;% coefficientB5=0;% coefficientb6=0;% coefficientB6=0;% coefficientb7=0;% coefficientB7=0;% coefficient
in this step. i want to calculate the values of my function andstore them in a Matrix.
x=0:0.1:T; % x is the time axisk=1:T/0.1+1;funcation=x;F(k)=funcation;for x=0:0.1:T;k=1:T/0.1+1;a0=F(k)+a0;endA0=0.1*a0/T;for x=0:0.1:T;k=1:T/0.1+1; b1=F(k).*sin(1.*wo.*x)+b1; b2=F(k).*sin(2.*wo.*x)+b2; b3=F(k).*sin(3.*wo.*x)+b3; b4=F(k).*sin(4.*wo.*x)+b4; b5=F(k).*sin(5.*wo.*x)+b5; b6=F(k).*sin(6.*wo.*x)+b6; b7=F(k).*sin(7.*wo.*x)+b7;endfor x=0:0.1:T;B1=0.1.*2.*b1./T.*sin(1.*wo.*x);B2=0.1.*2.*b2./T.*sin(2.*wo.*x);B3=0.1.*2.*b3./T.*sin(3.*wo.*x);B4=0.1.*2.*b4./T.*sin(4.*wo.*x);B5=0.1.*2.*b5./T.*sin(5.*wo.*x);B6=0.1.*2.*b6./T.*sin(6.*wo.*x);B7=0.1.*2.*b7./T.*sin(7.*wo.*x);endbq=B1+B2+B3+B4+B5+B6+B7;for x=0:0.1:T;k=1:T/0.1+1; a1=F(k).*cos(1.*wo.*x)+a1; a2=F(k).*cos(2.*wo.*x)+a2; a3=F(k).*cos(3.*wo.*x)+a3; a4=F(k).*cos(4.*wo.*x)+a4; a5=F(k).*cos(5.*wo.*x)+a5; a6=F(k).*cos(6.*wo.*x)+a6; a7=F(k).*cos(7.*wo.*x)+a7;endfor x=0:0.1:T; A1=0.01.*2.*a1./T.*cos(1.*wo.*x); A2=0.1.*2.*a2./T.*cos(2.*wo.*x);A3=0.1.*2.*a3./T.*cos(3.*wo.*x);A4=0.1.*2.*a4./T.*cos(4.*wo.*x);A5=0.1.*2.*a5./T.*cos(5.*wo.*x);A6=0.1.*2.*a6./T.*cos(6.*wo.*x);A7=0.1.*2.*a7./T.*cos(7.*wo.*x);endaq=A1+A2+A3+A4+A5+A6+A7;FQ=bq+aq+A0;plot(F(k))figureplot(FQ)
Expert Answer
Answer to Created Code Order Calculate Sketch Fourier Coefficients A0 Bn Without Using Fourier Serie Q26192480 . . .
OR