필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Find frequnecy of a data

조회 수: 1 (최근 30일)
MUHAMMAD RAHMAT ASMAT
MUHAMMAD RAHMAT ASMAT 2020년 6월 17일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello hyeee, from above statement i would like to find frequency of x below. i attach my code
%% Find frequency of the x data
x=[-0.7032 0.0299 -0.0173 -0.0299 0.0219 0.0017 0.0071 -0.0166 0.0128 -0.0038 -0.0050 0.0329 0.0153];
p=0;
m=length(x);
y=exp('-jw');
for i=1:m
p=p+x(i)*y^(1-i);
end
display(p);
and i encounter this after run
Undefined function 'exp' for input
arguments of type 'char'.
Error in G12_audio_code_project (line 67)
y=exp('-jw');
any idea what did i do wrong?
  댓글 수: 1
Star Strider
Star Strider 2020년 6월 17일
y = exp(-1j*w);
or, since ‘w’ is not defined, create ‘y’ as an anonymous function:
y=@(w)exp(-1j*w);
Experiment to get the result you want.
.

답변 (1개)

Shivang Srivastava
Shivang Srivastava 2020년 6월 18일
편집: Shivang Srivastava 2020년 6월 18일
From what I can understand you are facing trouble using exp() function when you are trying to find the frequency of data in array x.
In my opinion, one of these points is causing you the trouble:
  • The function definition of exp() only takes X -Input array which contains datatype single | double.
  • If you are trying to use j & w as a variables you should remove the single quotes and declare the variables before using them.
I suggest using the following command if you are taking exponent of your x array
x=[-0.7032 0.0299 -0.0173 -0.0299 0.0219 0.0017 0.0071 -0.0166 0.0128 -0.0038 -0.0050 0.0329 0.0153];
y = exp(x);
Refer to this link to exp() documentations for more information on using exp function: https://in.mathworks.com/help/matlab/ref/exp.html

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by