필터 지우기
필터 지우기

Convolution Command: Inputs Invalid

조회 수: 2 (최근 30일)
Andrew Cunningham
Andrew Cunningham 2018년 9월 23일
댓글: Andrew Cunningham 2018년 9월 27일
I am having trouble getting the output of my two functions to be accepted by the convolution function. Any help is appreciated getting this to work. I get the following when I use conv: Invalid data type. First and second arguments must be numeric or logical. I am familiar with matlab and can do the plots and other aspects once I get the function working. Thank you in advance for any help. I attached my code below:
t = -5:10; syms n x1 = symsum(dirac(t-8.*n),n,0,5); h1 = exp(-t).*heaviside(t); H1 = h1.'; Yt = conv(x1,h1);
My two functions are: x(t)=Sum(from 0-5) dirac(t-8n) h(t)=e^(-t)*u(t)
where u(t) is the step function
  댓글 수: 2
Image Analyst
Image Analyst 2018년 9월 23일
Why are you using symbolic variables? Can't you just use numerical values with actual values for the elements?
Andrew Cunningham
Andrew Cunningham 2018년 9월 23일
I have “syms n” because it is needed in order to use the symsum to do summation. Cause n is also only from 0 to 5 while the time plot needs to be larger to plot the convolution of the two functions

댓글을 달려면 로그인하십시오.

채택된 답변

Viren Gupta
Viren Gupta 2018년 9월 27일
I tried relicating your code. x1 is of type sym. You can convert x1 into numeric type using double(x1). That should solve the error. 'h1' is already a numeric type variable
  댓글 수: 1
Andrew Cunningham
Andrew Cunningham 2018년 9월 27일
Awesome thanks! I checked it out and that works. I solved it another way though and used ~isfinite(array) which turned the array into finite values. The only values in the array were infinity and 0 so I lost no data in doing it this way. Thank you for the help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by