Fourier Series Calculator Program in MATLAB ( Rectangular Pulse Example) 2
HTML-код
- Опубликовано: 11 окт 2024
- In this video we will graph the rectangular pulse example using our Fourier Series Calculator.
Find the Fourier coefficients for the periodic rectangular wave shown in Fig. 2-12a, where T is the
pulse width and is the period. The complex Fourier coefficients.
Examples taken from: Digital and Analog Communication Systems
CAS Project: Advance Engineering Mathematics Erwin Kreyszig
CAS PROJECT. Fourier Series of 2L-Periodic
Functions. (a) Write a program for obtaining partial
sums of a Fourier series (5). b) Apply the program to Probs. 8-11, graphing the first
few partial sums of each of the four series on common
axes. Choose the first five or more partial sums until
they approximate the given function reasonably well.
Compare and comment
Explanation on how the program works ?
Part 1: • Fourier Series Calcula...
Script:
%% FOURIER SERIES CALCULATOR by: JEROME COLICO
clear all
clc
close all
%% USER INPUT
syms f(x) x s(n) a(n) b(n)
f(x)=x % for expression input
%integration Parameters
upper=1;
lower=0;
L=0.5; % if given period divide by 2
%Plotting Parameters
durationL=-2
durationU=3
%Evaluation
accuracy=128 %n parameter in the formula
%%
s(n)=n;
a_o=(1/(2*L))*int(f(x),x,lower,upper)
%SYMBOLIC INTEGRATION
a(n)=(1/(L))*int(f(x)*cos((s(n)*pi*x)/L),x,lower,upper);
b(n)=(1/(L))*int(f(x)*sin((s(n)*pi*x)/L),x,lower,upper);
x=durationL:0.01:durationU;
y=0;
%% EVALUATION
for n=1:accuracy
ytemp= a(n)*cos(x*n*pi/L)+ b(n)*sin(x*n*pi/L);
y=ytemp+y;
end
y=y+a_o;
%% PLOTTING
plot(x,y,'LineWidth',1.5)
%% FOURIER SERIES CALCULATOR by: JEROME COLICO
Watch other MATLAB playlist in my channel.
Interesting vlog
👍
Here watching
interesting! i am here na! hehe Ate DJ_Li
thank you so much for this beautiful video, but could you please let us know what we should do if we have a piecewise function?
You're welcome. Well you have to analyze the problem just like what I did in the Part 1 and Part 2. As long as you were able to determine the parameter you're all good. Since I've made the program capable solving any functions
I had remember how w hard to do this
Hahaha it is much easier now right haha?
Cheers and have fun learning!