필터 지우기
필터 지우기

simulink matlab function code error?

조회 수: 1 (최근 30일)
Sandeep Kumar
Sandeep Kumar 2015년 11월 30일
댓글: Walter Roberson 2015년 12월 2일
hello every one , i have been tring to implement calculating twiddle factors in matlab editor using "function", my code is working fine , the same thing i am implementing in the matlab function block in simulink its not working please kindly help, my code in matlab function block is
function y = twiddles_12345(u)
fft_length = input('u');
for mm = 0:1:(fft_length-1)
theta = (-2*pi*mm*1/fft_length);
twiddle(mm+1) = cos(theta) + (1i*(sin(theta)));
y = real(twiddle);
y = y'
end

답변 (1개)

Walter Roberson
Walter Roberson 2015년 11월 30일
Before the loop use
twiddle = complex(zeros(1,fft_length), zeros(1,fft_length));
In the loop you might need
twiddle(mm+1) = complex(cos(theta), sin(theta));
  댓글 수: 3
Walter Roberson
Walter Roberson 2015년 12월 2일
What errors is it showing?
Walter Roberson
Walter Roberson 2015년 12월 2일
The
y = real(twiddle);
y = y'
should not be inside the loop.

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

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by