Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have created this code in order to calculate and sketch the Fourier Coefficients A0 ,An ,and Bn without using Fourier Series command but,unfortunately the
I have created this code in order to calculate and sketch the Fourier Coefficients A0 ,An ,and Bn without using Fourier Series command but,unfortunately the plots results did not look like a Fourier Series. if someone please guide me to solve this problem.
*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 this project
T=1; %Time Period wo=2*pi/T; a0=0;% coefficient A0=0;% coefficient a1=0;% coefficient A1=0;% coefficient a2=0;% coefficient A2=0;% coefficient a3=0;% coefficient A3=0;% coefficient a4=0;% coefficient A4=0;% coefficient a5=0;% coefficient A5=0;% coefficient a6=0;% coefficient A6=0;% coefficient a7=0;% coefficient B7=0;% coefficient b1=0;% coefficient B1=0;% coefficient b2=0;% coefficient B2=0;% coefficient b3=0;% coefficient B3=0;% coefficient b4=0;% coefficient B4=0;% coefficient b5=0;% coefficient B5=0;% coefficient b6=0;% coefficient B6=0;% coefficient b7=0;% coefficient B7=0;% coefficient
in this step. i want to calculate the values of my function and store them in a Matrix.
x=0:0.1:T; % x is the time axis k=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; end A0=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; end for 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); end bq=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; end for 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); end aq=A1+A2+A3+A4+A5+A6+A7; FQ=bq+aq+A0; plot(F(k)) figure plot(FQ)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started