sawtooth unexpected changes in simulink

1 visualización (últimos 30 días)
BARAN Özbakr
BARAN Özbakr el 5 de Mzo. de 2014
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

Respuestas (0)

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by