Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

convolution in matlab

Status
Not open for further replies.

mastevano

Newbie level 6
Joined
Oct 25, 2004
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
129
Hello!

I'm tryinig to write a simple convolution program in matlab, but i keep getting stuck!

Basically, I'm trying to convolve two signals:

1) x(t)=3sin(50*pi*t) + sin(220*pi*t) sample at 250Hz from 0 to .3 sec
2) g(t)=150*e^(-112t)*sin(112t) sampled at 250Hz from 0 to .1 sec

So, I know that the first signal will consist of 75 sample at 4ms intervals and the second will consist of 25 samples at 4ms intervals. I was able to graph the first fuction in matlab using the stem function.

I'm having a hard time graphing the second equation. I keep getting the following error:

??? Error using ==> *
Inner matrix dimensions must agree.

For equation 1 I defined t as such: 0:.004:.3 and for equation 2 I used a different variable, n, defined as 0:.004:.1.

Any help is greatly appreciated!
 

I think that instead of using the operator "*" you should use the operator ".*". ".*" is an "element-wise" multiplication instead of normal matrix multiplication which is performed by simply "*". For more information on the operator, type "help .*".

Added after 5 minutes:

Being more clear:

g(t)=150*e^(-112t)*sin(112t)

This should be changed to

g(t)=150*e^(-112t).*sin(112t);

e^(-112t) and sin(112t) are both matrices, so you need to be careful on how they are getting multiplied.[/quote]
 

    mastevano

    Points: 2
    Helpful Answer Positive Rating
Thank you! That helped out a lot!!! Can I now just use CONV to do my convolution?
 

Can I now just use CONV to do my convolution?

Yes, you should be able to just type...

y = conv(g, x);

The order of the arguments of conv() shouldn't matter.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top