Simulink frequency input for sine block

조회 수: 35 (최근 30일)
Dee Nolovich
Dee Nolovich 2015년 12월 21일
편집: Renato Agurto 2015년 12월 21일
Hello - In Simulink, I am trying to create a discrete sine wave that takes in 'frequency' as an input. The Sine Wave block in Simulink only allows setting the value inside the block, but it cannot be obtained from an external value. I have tried to do this via the Matlab workspace as follows:
function y = fcn(f,t)
%#codegen
[y] = sin(2*pi*f.*t);
However, the dimensions of the output from the original Sine Block is D:[frame_size,1], and my output from my custom block is D:[2097153]. This doesn't even make sense to me since the time input I selected is:0:1/30.72e6/8:32768/(30.72e6/8). This should equate to a frame_size of 32768. I attach a photo.
Any pointers on how I can recreate a Discrete frame_based Sine Wave block that takes an external frequency input?
Thanks, -D

답변 (1개)

Renato Agurto
Renato Agurto 2015년 12월 21일
편집: Renato Agurto 2015년 12월 21일
Hi. You could set the internal frequency of the sine function to 1 and multiply the input signal by the desired frequency

카테고리

Help CenterFile Exchange에서 Additional Math and Discrete에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by