Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
fourier series

Subject: fourier series

From: iqra

Date: 17 Mar, 2013 12:16:18

Message: 1 of 2

this piece of code is for fourier series calculation but its giving me error at syms,,plz can anyone help me..
>> L=8;
>>syms n x

>>a_n=sqrt(2/L)*(2*L)/(n*pi)*((sin((n*pi)/2))^2)*sin(n*pi)%fourier coefficient a_n
>>b_n=-sqrt(2/L)*((2*L)/(n*pi))*((sin((n*pi)/2))^2)*cos(n/pi)
>>vx=symsum(a_n*sqrt(2/L)*cos(n*2*pi*x)/L,n,1,9);
>>plot(x,v_x);
>>grid on;
>>axis([0 8 -1.4 1.4]);
>>hold on;
??? >>syms n x;
    |
Error: Unexpected MATLAB operator.

Subject: fourier series

From: Christopher Creutzig

Date: 4 Apr, 2013 09:17:09

Message: 2 of 2

On 17.03.13 13:16, iqra wrote:
> this piece of code is for fourier series calculation but its giving me error at syms,,plz can anyone help me..
>>> L=8;
>>>syms n x
>
>>>a_n=sqrt(2/L)*(2*L)/(n*pi)*((sin((n*pi)/2))^2)*sin(n*pi)%fourier coefficient a_n
>>>b_n=-sqrt(2/L)*((2*L)/(n*pi))*((sin((n*pi)/2))^2)*cos(n/pi)
>>>vx=symsum(a_n*sqrt(2/L)*cos(n*2*pi*x)/L,n,1,9);
>>>plot(x,v_x);
>>>grid on;
>>>axis([0 8 -1.4 1.4]);
>>>hold on;
> ??? >>syms n x;
> |
> Error: Unexpected MATLAB operator.
>

That looks like you copied & pasted something someone sent to you. Don't
include the “>>” in what you copy and paste to MATLAB, only copy the
parts behind that, the “>>” is the MATLAB prompt.


HTH,
Christopher

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us