Azzera filtri
Azzera filtri

plot complex exponential fourier series

6 visualizzazioni (ultimi 30 giorni)
yazeed Alshorman
yazeed Alshorman il 9 Apr 2016
Hi, I'm new in MATLAB program and I need some help to solve my homework. my homework say : plot complex exponential fourier series using MATLAB where the user input the value of amplitude A, fundamental period and value of N where the summation limit between -N,N. then the program will plot curve for summation limit between -1,1. then for summation between -2,2. and increase N value to reach to summation limit between -20,20. I don't know if that right way to write code, but this is code that I wrote it, please help me.
clear
clc
A=input('Enter A: ');
T0=input('Enter T0: :');
N=input('Enter N: ');
W0= 2*pi/T0;
t=linspace(100,100,10000);
suma=0;
for n=-N:N %%n could be any number, bigger n - better approximation
B= integral(1*exp(-1i*n*W0*t),0,T0);
cn=(1/T0)*B;
suma = suma + (cn*exp(1i*n*W0*t));
end
plot(t,suma)
grid

Risposte (0)

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by