sawtooth unexpected changes in simulink

조회 수: 1 (최근 30일)
BARAN Özbakr
BARAN Özbakr 2014년 3월 5일
Hello everyone, I am trying to create triangular wave in simulink in user defined function:
My code is;
function [s1,s2,s3,s4,g1,g2,g3,g4,g1in,g2in,g3in,g4in]= fcn(sin)
persistent t;
s1=[0];
s2=[0];
s3=[0];
s4=[0];
a=[0];
b=[0];
c=[0];
d=[0];
coder.extrinsic('sawtooth')
if isempty(t)
t=0;
end
T=0.000001;
Ts=0.000001;
t=t+Ts;
a=sawtooth(2*1000*pi*t,0.5);
s1=a;
b=sawtooth(2*1000*pi*t-pi,0.5)/4;
s2=b+0.25;
c=sawtooth(2*1000*pi*t,0.5)/4;
s3=c-0.25;
d=sawtooth(2*1000*pi*t-pi,0.5)/4;
s4=d-0.75;
end
actually, I am trying to create triangular wave that its freq is 1000 Hz. I could do it with this code, but after 3 or 4 simulation freq of triangular wave is changed itself. Same code same simulink but it is changed
I could not understand that . May u help me ?
thankss

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by