fourier series spectra plot

1 view (last 30 days)
Darwin Harianto
Darwin Harianto on 8 Apr 2015
i am using matlab to plot fourier spectra, but i keep getting this error _Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in sym/double (line 514) Xstr = mupadmex('symobj::double', S.s, 0);
Error in datachk (line 11) y = full(double(x));
Error in stem (line 83) h = [h specgraph.stemseries('YData',datachk(y(:,k)), xdata{:},...
Error in tes3 (line 13) stem(n,V);_
this is my code
syms n t;
T = 2*pi;
w = 2*pi/T;
n = 1:10;
a0 = 1/T*int(5*t+4*cos(3*t)+4*sin(3*t)-2*sin(2*t),t,0,T/2);
an = 2/T*int((5*t+4*cos(3*t)+4*sin(3*t)-2*sin(2*t))*cos(n*w*t),t,0,T/2);
bn = 2/T*int((5*t+4*cos(3*t)+4*sin(3*t)-2*sin(2*t))*sin(n*w*t),t,0,T/2);
sumab = 0;
for n = 1:10
sumab = sumab + an(n)*cos(n*w*t)+bn(n)*sin(n*w*t);
end
V = a0+sumab;
stem(n,V);
what can i do to solve this problem?
thanks for your reply

Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!