Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Standard view
Full view
of .
×
0 of .
Results for:
P. 1
Matlab Program for Determining Fourier Coefficients

# Matlab Program for Determining Fourier Coefficients

Ratings: 0|Views: 150|Likes:

### Availability:

See More
See less

09/23/2013

pdf

text

original

clc;clear all;nn=input('enter the value of upper limit of harmonics(that is the value 'n'):');u=input('enter the no. of discontinuities present (say u have DIfferent functions of x in different regime within the limits. just dpecify how many junction arepresent):');if (u~=0)i=1;lmts(i)=input('enter the lower bound of the range:');lmts(i+1+u)=input('enter the upper bound of the range:');i=i+1;ii=1;while(ii<=u)lmts(i)=input('value of x at discontinuity:');ii=ii+1;endelsei=1;lmts(i)=input('enter the lower bound of the range:');lmts(i+1)=input('enter the upper bound of the range:');endsyms x nj=1;if(u~=0)while(j<=(u+1))f(j)=input('enter the value of the function parts in terms of x:');j=j+1;endelsef=input('enter the value of the function in terms of x:');endif(u==0)cc=size(lmts);c=cc(2);d=(lmts(c)-lmts(1))/2;sao=(1/d)*(int((x/x)*f,lmts(1),lmts(c)));san=(1/d)*(int((x/x)*f*cos(n*x*pi/d),lmts(1),lmts(c)));sbn=(1/d)*(int((x/x)*f*sin(n*x*pi/d),lmts(1),lmts(c)));elsecc=size(lmts);c=cc(2);d=(lmts(c)-lmts(1))/2;k=1;kk=2;sao=0;san=0;sbn=0;while(k<=(u+1))ao=(1/d)*(int((x/x)*f(k),lmts(k),lmts(kk)));an=(1/d)*(int((x/x)*f(k)*cos(n*x*pi/d),lmts(k),lmts(kk)));bn=(1/d)*(int((x/x)*f(k)*sin(n*x*pi/d),lmts(k),lmts(kk)));sao=sao+ao;san=san+an;sbn=sbn+bn;k=k+1;kk=k+1;end

## Activity (2)

### Showing

AllMost RecentReviewsAll NotesLikes