MATLAB issue

Discussion in 'Math' started by jaygatsby, Feb 1, 2013.

  1. jaygatsby

    Thread Starter New Member

    Nov 23, 2011
    185
    23
    I'm trying to plot the FT of something, so:

    y = 30*sinc(5*f)*exp(-j*2*pi*f*2.5)

    MATLAB returns the infamous 'inner matrix dimensions must agree' error. I thought I could define the 'f' matrix to be of any length. When I take 'f' out of the exp, but leave it in the sinc(), it works. What doesn't it work when I put the f in the exp as well?

    Thanks,
    J
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    When multiplying two vectors you have to be aware of the difference between a vector multiplication (.*) and matrix multiplication (*).

    Replace the *exp() with .*exp()
     
    jaygatsby likes this.
  3. jaygatsby

    Thread Starter New Member

    Nov 23, 2011
    185
    23
    Many thanks to you sir
     
Loading...