i want to draw this function
but my code has an error:
code:
x=linspace(-5,5,1000);n=double(1:1:100);l=2;f=sin(x);g=cos(x); s=0;landa=((n*pi)/l );a=(2/l)*int(f.*sin((n*pi)/l)*x,0,l);b=(2/(l*landa))*int(g*sin((n*pi*x)/l,0,l)); for n=1:1:1000 p=((a*cos(landa*t)+ b*sin(landa*t))*sin((n*pi*x)/l)); s=s + p;endplot (x,t,s)
error:
>> f1Matrix dimensions must agree.Error in f1 (line 8)a=(2/l)*int(f.*sin((n*pi)/l)*x,0,l);
where is the problem of this error and code?
Best Answer