plot complex exponential fourier series

3 ビュー (過去 30 日間)
yazeed Alshorman
yazeed Alshorman 2016 年 4 月 9 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Fourier and Cosine Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by