i am trying to plot fourier series ( even function )

syms n t;
To=4;
wo=pi/2;
n=1:5;
an=[(2/To).*(int(cos(n.*wo.*t),t,-1,1))-(2/To).*(int(cos(n.*wo.*t),t,1,3))]
bn=[(2/To).*int(1*sin(n.*wo.*t),t,-1,1)]
f= an.*cos(n.*wo.*t)+bn.*sin(n.*wo.*t)
plot(n,subs(f,t))
Error using plot A numeric or double convertible argument is expected
Error in fourierseries (line 10) plot(n,subs(f,t))
% I tried a bunch of stuff like double or ezplot , but nothing seems to work

2 comentarios

Image Analyst
Image Analyst el 16 de Dic. de 2016
What are subs() and int()? They're not functions in any of my toolboxes, but I don't see you defining them as arrays either.
John Medhat
John Medhat el 18 de Dic. de 2016
int() is the integration function subs() is the substitute fucntion

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 15 de Dic. de 2016
clc; clear all ;
syms n t;
To=4;
wo=pi/2;
n=1:5;
an=[(2/To).*(int(cos(n.*wo.*t),t,-1,1))-(2/To).*(int(cos(n.*wo.*t),t,1,3))] ;
bn=[(2/To).*int(1*sin(n.*wo.*t),t,-1,1)] ;
f= an.*cos(n.*wo.*t)+bn.*sin(n.*wo.*t) ;
%
t1 = linspace(0,60) ;
f1 = double(subs(f,t1)) ;
plot(f1)
f1 is of 5 times of length(time), you have to pick what you want an dplot.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de Dic. de 2016

Comentada:

el 18 de Dic. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by