Using Embedded Matlab Function
이전 댓글 표시
Good Day!
Please consider the following:
I want to generate a Square wave using the Matlab function: sqaure(),in Simulnk using "Emebedded Matlab Function". I tried the same by using the 'eml.extrinsic'; But i keep getting an error which states :- Function output 'y' cannot be of MATLAB type. Please see following code:
function y = fcn(~)
%#eml
eml.extrinsic('square');
a=1;
dc = 50;
for i=1:100
f=(6908:1:9856)';
f=f*2*pi;
t=0:0.5:22;
y=a*square(f*t,dc); %ERROR
end;
THe Embedded Function Block has no input; only 1 output and a Clock trigger. I am not able to upload images. SOrry for that.
The idea behind this block is to generate a square wave based on the defined frequency range. •a = amplitude •f = frequency •dc = duty cycle
Please let me know what I'm doing wrong? Or point me to what I have to read in order to understand my error? Or provide alternative methods to accomplish what I want.
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!