Hi, I have problem with convolution. The script doesnt work on mine.

i'm trying to use [n,ny]=conv(x,nx,h,nh), but its said that i've input too much argument.
Here's my whole scripts
x = [3 11 7 0 -1 4 2];
nx = [-3:3];
h = [2 3 0 -5 2 1];
nh = [-1:4];
[n,ny]=conv(x,nx,h,nh)
I couldnt find anything wrong from my script, kindly help me please. Thank you

1 comentario

I couldnt find anything wrong from my script
Other than the fact that conv only takes two numerical inputs, you mean?
You seem to have invented your own definition of the conv function. For us to tell youl which function you should actually use, you would have to tell us what that definition is. I have no idea what your nx and nh are supposed to represent.
Also, note that
nx = [-3:3];
is exactly the same (but slightly slower) as:
nx = -3:3;
The brackets are unnecessary.

Iniciar sesión para comentar.

 Respuesta aceptada

madhan ravi
madhan ravi el 14 de Nov. de 2018
Editada: madhan ravi el 14 de Nov. de 2018
x = [3 11 7 0 -1 4 2];
nx = -3:3; %edited after Guillaume‘s comment
h = [2 3 0 -5 2 1];
nh = -1:4;
C=conv(x,h) %convolves only two vector only one output
C1=conv(nx,nh)

4 comentarios

when i used that script, its define that the "zero postion" is in the first number on the left. What if it should be the second number from the left?
madhan ravi
madhan ravi el 14 de Nov. de 2018
Editada: madhan ravi el 14 de Nov. de 2018
did you just try my answer because i didnt get any error?
"when i used that script, its define that the "zero postion" is in the first number on the left"
As I said in my comment to your question, you need to explain your definition of the convolution as it's not the standard one. There is no zero position in a convolution.
exactly as Guillaume states you need to clarify your statement

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 14 de Nov. de 2018

Comentada:

el 14 de Nov. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by