"Animesh Pandey" wrote in message <ikiqbm$qpd$1@fred.mathworks.com>...
> syms an bn a0;
> syms t n;
> syms x;
> y = sym(0);
> T = input('Enter the Time Period');
> N = input('Enter the number of terms');
>
> f = @(t) heaviside(t+0.5)heaviside(t0.5);
>
>
> an = int(f(t).*cos(n*pi*t/T),t,T,T)*(1/T);
> bn = int(f(t).*sin(n*pi*t/T),t,T,T)*(1/T);
> a0 = int(f(t),t,T,T)*(1/T);
> y = a0;
>
> pretty(a0);
> pretty(an);
> pretty(bn);
>
> hold on
> for i=1:0.01:N;
> y = y + subs(an, i) + subs(bn, i);
> ezplot(i, y), grid on
> end
> hold off
>
> Thus program computes the Fourier series of a square wave.
> But it gives the plot like after 4  5 minutes. Also the plot is not perfect.
> Please help !!!!
> Thanx ! :)
I wanted to give it a try but I'm getting errors with your code, are you sure you're using ezplot the right way? Besides what values of T and N did you choose?
??? Error using ==> inlineeval at 15
Error in inline expression ==>
Error: The input character is not valid in MATLAB statements or
expressions.
Error in ==> inline.feval at 36
INLINE_OUT_ = inlineeval(INLINE_INPUTS_,
INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ==> ezplotfeval at 52
z = feval(f,x(1));
Error in ==> ezplot>ezparam at 387
X = ezplotfeval(x, T);
Error in ==> ezplot at 165
hp = ezparam(cax, f{1}, f{2}, vars, labels, args{2:end});
Error in ==> sym.ezplot at 50
h = ezplot(char(f),char(y));
Error in ==> test at 23
ezplot(i, y);
