Results 1 to 15 of 15

Math Help - Mathematica plotting doesn't work

  1. #1
    Newbie
    Joined
    May 2009
    Posts
    21

    Mathematica plotting doesn't work

    Hi guys,

    Please help me understand why the output doesn't work as it should . What am I doing wrong ? thanks
    Attached Thumbnails Attached Thumbnails Mathematica plotting doesn't work-2121.gif  
    Last edited by CaptainBlack; June 3rd 2009 at 01:07 PM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by new guy View Post
    Hi guys,

    Please help me understand why the output doesn't work as it should . What am I doing wrong ? thanks
    What do you expect the plot to look like, and do you think Mathematica can plot that?

    (the sum is a pulse train of delta functionals)

    CB
    Last edited by CaptainBlack; June 3rd 2009 at 09:04 PM.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Super Member
    Joined
    Aug 2008
    Posts
    903
    How about taking the sum symmetrically and then plotting the limit superior and limit inferior:

    \mathop\text{lim inf}\limits_{N\to\infty} \left\{1+2\sum_{n=1}^{N} \cos(2\pi nt)\right\}

    \mathop\text{lim sup}\limits_{N\to\infty} \left\{1+2\sum_{n=1}^{N} \cos(2\pi nt)\right\}

    Here's my code to plot (empirically) the limit superior based on the first 100 terms:

    Code:
    f[t_, kmax_] := 1 + 2*Sum[Cos[2*Pi*k*t], 
          {k, 1, kmax}]; 
    ListPlot[Table[{t, Max[Table[f[t, nval], 
          {nval, 1, 100}]]}, 
       {t, 0, 5, 0.011}]]
    Is that close to what it would look like in the limit?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    May 2009
    Posts
    21
    Okay thank you both, I understand my mistake now .

    I have another question that troubles me , and I'll appreciate your advices.
    Given Sum of : X_N(t) =Sum [ Exp(j2*Pi*k*t) ] with lower limit -N and upper limit +N , -2<= t <= 2
    I need to calculate x(t) ,so I used Euler :
    X_N(t) = Sum e^(j2*pi*k*t) = Sum [ cos(2pi*k*t) + j*sin (2pi*k*t) ].

    Now ,if I'm mistaken the sinus part becom equal to zero , because the cycle
    of sinus is PI . But I have a problem with the Cosinus part , how can I
    simplify it ? the "t" parameter interrupts with the simplifying ......
    maybe separating it to conditions ? N=2R ------> even , N=2R+1 --> odd ?

    thanks in advance
    Attached Thumbnails Attached Thumbnails Mathematica plotting doesn't work-question.gif  
    Last edited by new guy; June 3rd 2009 at 10:26 PM.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by new guy View Post
    Okay thank you both, I understand my mistake now .

    I have another question that troubles me , and I'll appreciate your advices.
    Given Sum of : X_N(t) =Sum [ Exp(j2*Pi*k*t) ] with lower limit -N and upper limit +N , -2<= t <= 2
    I need to calculate x(t) ,so I used Euler :
    X_N(t) = Sum e^(j2*pi*k*t) = Sum [ cos(2pi*k*t) + j*sin (2pi*k*t) ].

    Now ,if I'm mistaken the sinus part becom equal to zero , because the cycle
    of sinus is PI . But I have a problem with the Cosinus part , how can I
    simplify it ? the "t" parameter interrupts with the simplifying ......
    maybe separating it to conditions ? N=2R ------> even , N=2R+1 --> odd ?

    thanks in advance
    Due to symetries:

    x_N(t)=\sum_{k=-N}^N e^{j 2 \pi k t}=1+\text{Re}\left[2\sum_{k=1}^N e^{j 2 \pi k t}\right]

    and the sum on the right is a finite geometric series and so you should know that it sums to:

    x_N(t)=\text{Re}\left[2\ \frac{1-e^{j2\pi t (N+1)} }{1-e^{j2\pi t}}\right]-1

    which you should be able to simplify further.

    CB
    Last edited by CaptainBlack; June 5th 2009 at 05:17 AM.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by CaptainBlack View Post
    Due to symetries:

    x_N(t)=\sum_{k=-N}^N e^{j 2 \pi k t}=1+\text{Re}\left[2\sum_{k=1}^N e^{j 2 \pi k t}\right]

    and the sum on the right is a finite geometric series and so you should know that it sums to:

    x_N(t)=\text{Re}\left[2\ \frac{1-e^{j2\pi t (N+1)} }{1-e^{j2\pi t}}\right]-1

    which you should be able to simplify further.

    CB
    There is of course another way of thinking of the finite two sided series as a geometric series which does not involve taking real parts, but I will leave that to the reader to sort out.

    CB
    Last edited by CaptainBlack; June 5th 2009 at 05:18 AM.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    May 2009
    Posts
    21
    Quote Originally Posted by CaptainBlack View Post
    Due to symetries:

    x_N(t)=\sum_{k=-N}^N e^{j 2 \pi k t}=1+\text{Re}\left[2\sum_{k=0}^N e^{j 2 \pi k t}\right]

    and the sum on the right is a finite geometric series and so you should know that it sums to:

    x_N(t)=1+\text{Re}\left[2\ \frac{1-e^{j2\pi t (N+1)} }{1-e^{j2\pi t}}\right]

    which you should be able to simplify further.

    CB
    thanks for the help .
    Something is not clear to me , how did you make your first move with the :
    1 + 2*Re(Sigma[....]) ? where did the "1" come from ?
    Nonetheless , I need to see how X_N(t) "behaves" with a large "N" , and
    assuming (with your solution) N---->infinity , the x(t) would be what exactly ?

    X_n(t) = 1 + 2[ 1-cos(2pi*t*(N+1]) ] / 1-cos(2pi*t)



    I tried to to something like what you said , using a geometric series . I'd like your opinion with my point of view . thanks again (:
    Attached Thumbnails Attached Thumbnails Mathematica plotting doesn't work-11.gif  
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by new guy View Post
    thanks for the help .
    Something is not clear to me , how did you make your first move with the :
    1 + 2*Re(Sigma[....]) ? where did the "1" come from ? (:
    The 1 is the k=0 term of the original series.

    The sum tends to a sequence of spikes at integer values of x (which is what I said in my first post

    CB
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    May 2009
    Posts
    21
    Quote Originally Posted by CaptainBlack View Post
    The 1 is the k=0 term of the original series.

    The sum tends to a sequence of spikes at integer values of x (which is what I said in my first post

    CB
    But you still count from k=0 to infinity . doesn't it suppose to be from k=1 ?

    And now , when N----> infinity
    X_n(t) = 1 + 2[ 1-cos(2pi*t*(N+1]) ] / 1-cos(2pi*t) ,
    I think there could be a problem with Cos(+inf) .... can you please explain ?
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by new guy View Post
    But you still count from k=0 to infinity . doesn't it suppose to be from k=1 ?

    And now , when N----> infinity
    X_n(t) = 1 + 2[ 1-cos(2pi*t*(N+1]) ] / 1-cos(2pi*t) ,
    I think there could be a problem with Cos(+inf) .... can you please explain ?
    Yes it should be from 1 to infinity, I think I have corrected the offending post (but check it)

    It is an impropper sum, you only ever consider finite sums and then take the limit as the upper limit goes to infinity (and what you have in that limit is not a normal function as it is zero every where except at integer values of x where it is infinite - in a particulatly odd manner)

    CB
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Newbie
    Joined
    May 2009
    Posts
    21
    Quote Originally Posted by CaptainBlack View Post
    Yes it should be from 1 to infinity, I think I have corrected the offending post (but check it)

    It is an impropper sum, you only ever consider finite sums and then take the limit as the upper limit goes to infinity (and what you have in that limit is not a normal function as it is zero every where except at integer values of x where it is infinite - in a particulatly odd manner)

    CB
    I'm trying to develop the X_N(t) you mentioned above ,into a pulse train of deltas ,something like δ(t-nT) however came up empty handed . After
    using Euler and taking the Real part out of XN(t) ,I can't see any way to get to delta pulse train . Are you sure that's the way ? thanks you for all the replies !
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by new guy View Post
    I'm trying to develop the X_N(t) you mentioned above ,into a pulse train of deltas ,something like δ(t-nT) however came up empty handed . After
    using Euler and taking the Real part out of XN(t) ,I can't see any way to get to delta pulse train . Are you sure that's the way ? thanks you for all the replies !
    Consider the (formal) complex Fourier series of a series of deltas at 0,\ \pm 1,\ \pm 2,\ ... You should get every coefficient equal to 1. From there you should be able to get to the sum you seek.

    CB
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by new guy View Post
    I'm trying to develop the X_N(t) you mentioned above ,into a pulse train of deltas ,something like δ(t-nT) however came up empty handed . After
    using Euler and taking the Real part out of XN(t) ,I can't see any way to get to delta pulse train . Are you sure that's the way ? thanks you for all the replies !
    Code:
    >
    >.. define function to sum the finite series and plot the result
    >
    >function FTdelta(n)
    $  global I
    $  k=[-n:n]';
    $  t=-0.5:0.001:0.5;
    $  ss=exp(2*pi*I*k*t);
    $  SS=sum(ss');
    $  color(12);xplot(t,re(SS'));
    $  hold on;color(10);plot(t,im(SS'));hold off;color(1);
    $  return SS'
    $endfunction
    >
    >.. now look at a plot of the series sum
    >
    >N=30;
    >FTdelta(N);
    >xplot;title("k=30");
    >
    >.. now compute and plot the series sum that we have deduced
    >
    >t=-0.5:0.001:0.5;
    >xx=re(2*(1-exp(2*pi*I*t*(N+1)))/(1-exp(2*pi*I*t)))-1;
    >
    >
    >color(1);xplot(t,re(xx));
    >
    The results in a single plot are shown in the attachments. (note: the size of the overshoot or ringing is always the same size relative to the peak, this is Gibb's phenoemum (sp?))

    CB
    Attached Thumbnails Attached Thumbnails Mathematica plotting doesn't work-gash.png   Mathematica plotting doesn't work-gash1.png  
    Last edited by CaptainBlack; June 5th 2009 at 02:22 PM.
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Newbie
    Joined
    May 2009
    Posts
    21
    Quote Originally Posted by CaptainBlack View Post
    Consider the (formal) complex Fourier series of a series of deltas at 0,\ \pm 1,\ \pm 2,\ ... You should get every coefficient equal to 1. From there you should be able to get to the sum you seek.

    CB
    Don't get me wrong , I'm greatful for your marvelous help , but you got me
    confused this time. First you showed me how to get to
    XN(t)=1+2Re*sigma(e^(2pi*jkt)) , and mathematically that's fine of course .But now you're suggesting going back to to Sigma and extract the deltas for there ?

    I'll tell you what, I've done a plot of the function with Mathematica and when the "N" is big enough (let us take for example N=200000) I can see
    that this is indeed a train of deltas , but I'm very confused about the theoretical point of view . I've tried a few ways however got stucked with them .

    As I said before , I'm a beginner in this area and would very much appreciate if you could explain .
    Follow Math Help Forum on Facebook and Google+

  15. #15
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by new guy View Post
    Don't get me wrong , I'm greatful for your marvelous help , but you got me
    confused this time. First you showed me how to get to
    XN(t)=1+2Re*sigma(e^(2pi*jkt)) , and mathematically that's fine of course .But now you're suggesting going back to to Sigma and extract the deltas for there ?
    I'm not suggesting anything of the sort, the code and plots showed that the finite series and the sum of that which I gave do indeed give that same result.


    I'll tell you what, I've done a plot of the function with Mathematica and when the "N" is big enough (let us take for example N=200000) I can see
    that this is indeed a train of deltas , but I'm very confused about the theoretical point of view . I've tried a few ways however got stucked with them .

    As I said before , I'm a beginner in this area and would very much appreciate if you could explain .
    Approach this from the other direction, and ask what is the Fourier series of a comb of deltas?

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Mathematica - 2D Discontinuous plotting
    Posted in the Math Software Forum
    Replies: 5
    Last Post: August 17th 2011, 08:48 AM
  2. Mathematica 8 plotting function 1/x bug??
    Posted in the Math Software Forum
    Replies: 3
    Last Post: May 9th 2011, 11:40 AM
  3. Plotting a function with wolfram mathematica
    Posted in the Math Software Forum
    Replies: 2
    Last Post: March 11th 2010, 06:53 AM
  4. Plotting Asymptotes in Mathematica
    Posted in the Math Software Forum
    Replies: 1
    Last Post: July 5th 2009, 02:44 AM
  5. Mathematica Double Sequence Plotting in 3D
    Posted in the Math Software Forum
    Replies: 12
    Last Post: September 13th 2008, 10:55 AM

Search Tags


/mathhelpforum @mathhelpforum